Browse Source

test against python3.9

https://github.com/fphammerle/ical2vdir/commit/d679a828a6de976c477ddfa7f3ced0b1be57fc3c
https://github.com/fphammerle/switchbot-mqtt/commit/b2747c3a3a5251285732694945fa836ee3552600
Fabian Peter Hammerle 3 years ago
parent
commit
4414282f12
4 changed files with 21 additions and 23 deletions
  1. 6 3
      .github/workflows/python.yml
  2. 1 0
      setup.py
  3. 7 10
      tests/test_cli_export_config.py
  4. 7 10
      tests/test_cli_transmit.py

+ 6 - 3
.github/workflows/python.yml

@@ -39,6 +39,7 @@ jobs:
         - 3.6
         - 3.7
         - 3.8
+        - 3.9
       fail-fast: false
     steps:
     - uses: actions/checkout@v1
@@ -50,11 +51,13 @@ jobs:
       env:
         PYTHON_VERSION: ${{ matrix.python-version }}
     - run: pipenv graph
-    - run: pipenv run pytest --cov=cc1101 --cov-report=term-missing --cov-fail-under=94
-    - run: pipenv run pylint --load-plugins=pylint_import_requirements cc1101
+    - run: pipenv run pytest --cov="$(cat *.egg-info/top_level.txt)" --cov-report=term-missing --cov-fail-under=94
+    # https://github.com/PyCQA/pylint/issues/3882
+    - run: python3 -c 'import sys; sys.exit(sys.version_info < (3, 9))'
+        || pipenv run pylint --load-plugins=pylint_import_requirements "$(cat *.egg-info/top_level.txt)"
     # https://github.com/PyCQA/pylint/issues/352
     - run: pipenv run pylint tests/*
-    - run: pipenv run mypy cc1101 tests
+    - run: pipenv run mypy "$(cat *.egg-info/top_level.txt)" tests
     # >=1.9.0 to detect branch name
     # https://github.com/coveralls-clients/coveralls-python/pull/207
     # https://github.com/coverallsapp/github-action/issues/4#issuecomment-547036866

+ 1 - 0
setup.py

@@ -54,6 +54,7 @@ setuptools.setup(
         "Programming Language :: Python :: 3.6",
         "Programming Language :: Python :: 3.7",
         "Programming Language :: Python :: 3.8",
+        "Programming Language :: Python :: 3.9",
         "Topic :: Home Automation",
         "Topic :: Communications",
     ],

+ 7 - 10
tests/test_cli_export_config.py

@@ -128,13 +128,10 @@ def test_logging(caplog):
     ) as transceiver_mock, caplog.at_level(logging.DEBUG):
         transceiver_mock().__enter__().__str__.return_value = "dummystr"
         cc1101._cli._export_config()
-    assert caplog.record_tuples == [
-        (
-            "cc1101._cli",
-            logging.DEBUG,
-            "args=Namespace(base_frequency_hertz=None, debug=False, disable_checksum=False, "
-            "format='python-list', output_power_settings=None, packet_length_mode=None, "
-            "symbol_rate_baud=None, sync_mode=None)",
-        ),
-        ("cc1101._cli", logging.INFO, "dummystr"),
-    ]
+    assert len(caplog.records) == 2
+    assert caplog.records[0].levelno == logging.DEBUG
+    assert caplog.records[0].name == "cc1101._cli"
+    assert caplog.records[0].message.startswith(
+        "args=Namespace(base_frequency_hertz=None, "
+    )
+    assert caplog.record_tuples[1] == ("cc1101._cli", logging.INFO, "dummystr")

+ 7 - 10
tests/test_cli_transmit.py

@@ -211,13 +211,10 @@ def test_logging(caplog, payload):
     ):
         transceiver_mock().__enter__().__str__.return_value = "dummy"
         cc1101._cli._transmit()
-    assert caplog.record_tuples == [
-        (
-            "cc1101._cli",
-            logging.DEBUG,
-            "args=Namespace(base_frequency_hertz=None, debug=False, "
-            "disable_checksum=False, output_power_settings=None, packet_length_mode=None, "
-            "symbol_rate_baud=None, sync_mode=None)",
-        ),
-        ("cc1101._cli", logging.INFO, "dummy"),
-    ]
+    assert len(caplog.records) == 2
+    assert caplog.records[0].name == "cc1101._cli"
+    assert caplog.records[0].levelno == logging.DEBUG
+    assert caplog.records[0].message.startswith(
+        "args=Namespace(base_frequency_hertz=None, "
+    )
+    assert caplog.record_tuples[1] == ("cc1101._cli", logging.INFO, "dummy")