Skip to content

Commit

Permalink
Re-enable Pytest runs on Windows (youtube#385)
Browse files Browse the repository at this point in the history
Enables Pytest runs on windows with a few changes:

* Enable Windows pytest runs
* Enable pip caching - Speeds up tests by caching pip install results
* Add missing atomicwrites - Required on Windows for pytest+coverage runs. It's an undeclared
indirect dependency of some involved packages.
* Disable Raspi launcher tests on Windows - The pexpect and shell handling as written wont work on Windows,
and this module isn't written or intended to run on it.
* Disable Build-id tests on Win - These are newly added and fail with absolute/temporary path
handling. Need to be looked at.
* Disable failing SABI test on Windows - Old test that fails due to invalid temporary path handling on Win

b/279747505
b/282040638
b/281098312
  • Loading branch information
kaidokert committed May 16, 2023
1 parent 3c24834 commit c28c35f
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ jobs:
python-test:
strategy:
matrix:
# TODO(b/281098312): pytest fails on windows-latest
os: [ubuntu-latest]
os: [ubuntu-latest, windows-latest]
python-version: ['3.7', '3.11']
fail-fast: false
runs-on: ${{ matrix.os }}
Expand All @@ -32,6 +31,7 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install Pip Packages
run: pip install --require-hashes --no-deps -r ${{ github.workspace }}/docker/pytest/requirements.txt
- name: Run Tests
Expand Down
2 changes: 2 additions & 0 deletions cobalt/build/get_build_id_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
_TEST_BUILD_NUMBER = 1234 + get_build_id.COMMIT_COUNT_BUILD_NUMBER_OFFSET


# TODO(b/282040638): fix and re-enabled this
@unittest.skipIf(os.name == 'nt', 'Broken on Windows')
class GetBuildIdTest(unittest.TestCase):

def setUp(self):
Expand Down
1 change: 1 addition & 0 deletions docker/pytest/requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ jsonschema<5
junitparser==2.8.0
pexpect==4.8.0
six==1.12.0
atomicwrites==1.4.1
3 changes: 3 additions & 0 deletions docker/pytest/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
#
# pip-compile --generate-hashes requirements.in
#
atomicwrites==1.4.1 \
--hash=sha256:81b2c9071a49367a7f770170e5eec8cb66567cfbbc8c73d20ce5ca4a8d71cf11
# via -r docker/pytest/requirements.in
attrs==21.4.0 \
--hash=sha256:2d27e3784d7a565d36ab851fe94887c5eccd6a463168875832a1be79c82828b4 \
--hash=sha256:626ba8234211db98e869df76230a137c4c40a12d72445c45d5f5b716f076e2fd
Expand Down
1 change: 1 addition & 0 deletions starboard/raspi/shared/launcher_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
# pylint: disable=missing-class-docstring


@unittest.skipIf(os.name == 'nt', 'Pexpect does not work on Windows')
class LauncherTest(unittest.TestCase):

def setUp(self):
Expand Down
3 changes: 3 additions & 0 deletions starboard/sabi/generate_sabi_id_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ def testRainyDayNonexistentFile(self):
with self.assertRaises(IOError):
generate_sabi_id.DoMain(['-f', 'invalid_filename'])

# TODO(b/281098312): fix and re-enable this
@unittest.skipIf(os.name == 'nt',
'Broken on Windows due to temp path handling')
def testRainyDayBadFile(self):
bad_sabi_json = tempfile.NamedTemporaryFile(mode='w') # pylint: disable=consider-using-with
bad_sabi_json.write('{}')
Expand Down

0 comments on commit c28c35f

Please sign in to comment.