From 3be8967eb4b57d860d3481cb7d4f2fff4fadab95 Mon Sep 17 00:00:00 2001 From: Elvis Pranskevichus Date: Fri, 25 Oct 2019 09:47:15 -0400 Subject: [PATCH] Add github test workflow --- .github/workflows/test-requirements.txt | 7 ++++ .github/workflows/tests.yml | 48 +++++++++++++++++++++++++ tests/test_base.py | 7 ++-- tests/test_process.py | 4 ++- 4 files changed, 62 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/test-requirements.txt create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/test-requirements.txt b/.github/workflows/test-requirements.txt new file mode 100644 index 0000000..1347173 --- /dev/null +++ b/.github/workflows/test-requirements.txt @@ -0,0 +1,7 @@ +Cython==0.29.10 +aiohttp +tinys3 +twine +psutil +pyOpenSSL==18.0.0 +flake8>=3.7.5 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..febdba3 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,48 @@ +name: Tests + +on: + push: + branches: + - master + - ci + pull_request: + branches: + - master + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + max-parallel: 4 + matrix: + python-version: [3.6, 3.7] + os: [ubuntu-16.04, macos-10.14] + + steps: + - uses: actions/checkout@v1 + with: + fetch-depth: 50 + submodules: true + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + + - name: Install macOS deps + if: matrix.os == 'macos-10.14' + run: | + brew install gnu-sed + brew install --force libtool + brew install --force autoconf + brew install --force automake + + - name: Install Python Deps + run: | + pip install --upgrade setuptools pip wheel + pip install -U -r .github/workflows/test-requirements.txt + + - name: Test + run: | + make distclean && make && make test + make distclean && make debug && make test diff --git a/tests/test_base.py b/tests/test_base.py index 512b0d7..c063519 100644 --- a/tests/test_base.py +++ b/tests/test_base.py @@ -159,7 +159,7 @@ class _TestBase: self.assertEqual(calls, [10, 1]) self.assertFalse(self.loop.is_running()) - self.assertLess(finished - started, 0.1) + self.assertLess(finished - started, 0.2) self.assertGreater(finished - started, 0.04) def test_call_later_2(self): @@ -219,9 +219,10 @@ class _TestBase: self.assertGreaterEqual(finished - started, 69) def test_call_at(self): - if os.environ.get('TRAVIS_OS_NAME'): + if (os.environ.get('TRAVIS_OS_NAME') + or os.environ.get('GITHUB_WORKFLOW')): # Time seems to be really unpredictable on Travis. - raise unittest.SkipTest('time is not monotonic on Travis') + raise unittest.SkipTest('time is not monotonic on CI') i = 0 diff --git a/tests/test_process.py b/tests/test_process.py index aa7def5..e1eb6cc 100644 --- a/tests/test_process.py +++ b/tests/test_process.py @@ -840,7 +840,9 @@ class Test_UV_Process_Delayed(tb.UVTestCase): }) def test_process_delayed_stdio__not_paused__no_stdin(self): - if os.environ.get('TRAVIS_OS_NAME') and sys.platform == 'darwin': + if ((os.environ.get('TRAVIS_OS_NAME') + or os.environ.get('GITHUB_WORKFLOW')) + and sys.platform == 'darwin'): # Randomly crashes on Travis, can't reproduce locally. raise unittest.SkipTest()