diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0127901b..a0e383e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,119 +3,52 @@ name: CI on: [push, pull_request] jobs: - test-all-38: - name: Python 3.8 on ${{ matrix.os }} ${{ matrix.arch }} + test-all: + name: UnitTests on ST${{ matrix.st-version }} ${{ matrix.os }} ${{ matrix.arch }} runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: os: - - windows-2019 - - macos-11 - - ubuntu-20.04 + - macos-latest + - ubuntu-latest + - windows-latest arch: - x86 - x64 + st-version: + - 3 + - 4 exclude: - - os: macos-11 + - st-version: 4 arch: x86 - - os: ubuntu-20.04 + - os: macos-latest + arch: x86 + - os: ubuntu-latest arch: x86 steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 + - uses: SublimeText/UnitTesting/actions/setup@v1 with: - python-version: '3.8' - architecture: ${{ matrix.arch }} - - name: Install dependencies - run: pip install -U flake8 pytest - - name: Run linter - run: flake8 - - name: Run tests - run: pytest + package-name: Package Control + sublime-text-version: ${{ matrix.st-version }} + - uses: SublimeText/UnitTesting/actions/run-tests@v1 + with: + package-name: Package Control env: - ST_DIR: ~/sublime_text GH_PASS: ${{ secrets.GH_PASS }} GL_PASS: ${{ secrets.GL_PASS }} BB_PASS: ${{ secrets.BB_PASS }} - # test-linux-33: - # name: Python 3.3.7 on ubuntu-18.04 x64 - # runs-on: ubuntu-18.04 - # steps: - # - uses: actions/checkout@v4 - # - uses: actions/setup-python@v5 - # with: - # python-version: '3.3.7' - # architecture: x64 - # - name: Install dependencies - # run: python dev/deps.py - # - name: Run linter - # run: python dev/lint.py - # - name: Run tests - # run: python dev/tests.py - # env: - # ST_DIR: ~/sublime_text - # GH_PASS: ${{ secrets.GH_PASS }} - # GL_PASS: ${{ secrets.GL_PASS }} - # BB_PASS: ${{ secrets.BB_PASS }} - - # test-mac-33: - # name: Python 3.3.7 on macos-11 x64 - # runs-on: macos-11 - # steps: - # - uses: actions/checkout@v4 - - # - name: Check pyenv - # id: check-pyenv - # uses: actions/cache@v4 - # with: - # path: ~/.pyenv - # key: macos-11-3.3-pyenv - - # - name: Install Python 3.3 - # run: python dev/pyenv-install.py 3.3 >> $GITHUB_PATH - - # - name: Install dependencies - # run: python dev/deps.py - # - name: Run linter - # run: python dev/lint.py - # - name: Run tests - # run: python dev/tests.py - # env: - # ST_DIR: ~/sublime_text - # GH_PASS: ${{ secrets.GH_PASS }} - # GL_PASS: ${{ secrets.GL_PASS }} - # BB_PASS: ${{ secrets.BB_PASS }} - - test-windows-33: - name: Python 3.3.5 on windows-2019 ${{ matrix.arch }} - runs-on: windows-2019 - strategy: - matrix: - arch: - - 'x86' - - 'x64' + lint: + name: Check Code Style + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - - name: Cache Python - id: cache-python - uses: actions/cache@v4 + - uses: actions/setup-python@v5 with: - path: ~/AppData/Local/Python3.3-${{ matrix.arch }} - key: windows-2019-python-3.3-${{ matrix.arch }} - - - name: Install Python 3.3.5 - run: python dev/python-install.py 3.3 ${{ matrix.arch }} | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - + python-version: '3.8' - name: Install dependencies - run: python dev/deps.py + run: pip install -U flake8 - name: Run linter - run: python dev/lint.py - - name: Run tests - run: python dev/tests.py - env: - ST_DIR: ~/sublime_text - GH_PASS: ${{ secrets.GH_PASS }} - GL_PASS: ${{ secrets.GL_PASS }} - BB_PASS: ${{ secrets.BB_PASS }} + run: flake8 diff --git a/package_control/tests/test_library.py b/package_control/tests/test_library.py index 1bdb1783..80f6264e 100644 --- a/package_control/tests/test_library.py +++ b/package_control/tests/test_library.py @@ -1,8 +1,11 @@ +import sys import unittest from .. import library from ._data_decorator import data_decorator, data +PY33 = sys.version_info[:2] == (3, 3) + @data_decorator class LibraryTests(unittest.TestCase): @@ -55,6 +58,7 @@ def escape_name(self, name, result): def translate_name(self, name, result): self.assertEqual(result, library.translate_name(name)) + @unittest.skipIf(PY33, "requires ST4 with py38") def test_names_to_libraries(self): self.assertEqual( [ @@ -83,7 +87,6 @@ def library_equal(self, a, b): @data( ( - (("test-lib", "3.3"), ("test-lib", "3.8")), (("test-lib", "3.3"), ("test.lib", "3.3")), (("test_lib", "3.3"), ("test.lib", "3.3")), (("testlib", "3.3"), ("test.lib", "3.3")), @@ -96,7 +99,6 @@ def library_not_equal(self, a, b): @data( ( - (("test-lib", "3.3"), ("test-lib", "3.8")), (("test-lib-1", "3.3"), ("test-lib-2", "3.3")), (("test-lib-a", "3.3"), ("test-lib-b", "3.3")), ) @@ -106,10 +108,21 @@ def library_lesser(self, a, b): @data( ( - (("test-lib", "3.8"), ("test-lib", "3.3")), (("test-lib-2", "3.3"), ("test-lib-1", "3.3")), (("test-lib-b", "3.3"), ("test-lib-a", "3.3")), ) ) def library_greater(self, a, b): self.assertGreater(library.Library(*a), library.Library(*b)) + + @unittest.skipIf(PY33, "requires ST4 with py38") + def test_library_not_equal_33_38(self): + self.assertNotEqual(library.Library("test-lib", "3.3"), library.Library("test-lib", "3.8")) + + @unittest.skipIf(PY33, "requires ST4 with py38") + def test_library_lesser_33_38(self): + self.assertLess(library.Library("test-lib", "3.3"), library.Library("test-lib", "3.8")) + + @unittest.skipIf(PY33, "requires ST4 with py38") + def test_library_greater_38_33(self): + self.assertGreater(library.Library("test-lib", "3.8"), library.Library("test-lib", "3.3")) diff --git a/unittesting.json b/unittesting.json new file mode 100644 index 00000000..b3cb6538 --- /dev/null +++ b/unittesting.json @@ -0,0 +1,5 @@ +{ + "tests_dir": "package_control/tests", + "pattern": "test*.py", + "verbosity": 1 +} \ No newline at end of file