diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a5b3e18c..d9ec99b8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,20 +14,20 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: ["3.7", "3.8", "3.9", "3.10", "3.11"] + python: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v2 - with: - path: code42cli - name: Setup Python uses: actions/setup-python@v1 with: python-version: ${{ matrix.python }} - name: Install tox - run: pip install tox==3.17.1 + run: | + pip install tox==3.17.1 + pip install . - name: Run Unit tests - run: cd code42cli; tox -e py # Run tox using the version of Python in `PATH` + run: tox -e py # Run tox using the version of Python in `PATH` - name: Submit coverage report uses: codecov/codecov-action@v1.0.7 with: @@ -56,4 +56,4 @@ jobs: - name: Start up the mock servers run: cd code42-mock-servers; docker-compose up -d --build - name: Run the integration tests - run: sleep 15; cd code42cli; tox -e integration + run: sleep 15; tox -e integration diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 4afff063..26262813 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -20,6 +20,8 @@ jobs: with: python-version: '3.x' - name: Install tox - run: pip install tox==3.17.1 + run: | + pip install tox==3.17.1 + pip install . - name: Build docs run: tox -e docs diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index ea8a73ff..e108ca6f 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: ["3.7", "3.8", "3.9", "3.10", "3.11"] + python: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index dfc4dfcb..ce003f92 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -20,6 +20,8 @@ jobs: with: python-version: '3.x' - name: Install tox - run: pip install tox==3.17.1 + run: | + pip install tox==3.17.1 + pip install . - name: Run style checks run: tox -e style diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 14e57479..c2871db6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,7 +14,7 @@ repos: hooks: - id: black - repo: https://github.com/pycqa/flake8 - rev: 3.8.3 + rev: 6.1.0 hooks: - id: flake8 additional_dependencies: diff --git a/setup.cfg b/setup.cfg index 22b1db08..f104e210 100644 --- a/setup.cfg +++ b/setup.cfg @@ -31,5 +31,7 @@ ignore = B904 # manual quoting B907 + # assertRaises-type + B908 # up to 88 allowed by bugbear B950 max-line-length = 80 diff --git a/setup.py b/setup.py index 04663e40..72965d45 100644 --- a/setup.py +++ b/setup.py @@ -41,14 +41,16 @@ "ipython>=8.10.0;python_version>='3.8'", "pandas>=1.1.3", "py42>=1.26.0", + "setuptools>=66.0.0", ], extras_require={ "dev": [ - "flake8==3.8.3", + "flake8>=4.0.0", "pytest==4.6.11", "pytest-cov==2.10.0", "pytest-mock==2.0.0", "tox>=3.17.1", + "importlib-metadata<5.0", ], "docs": [ "sphinx==4.4.0", diff --git a/tests/logger/test_init.py b/tests/logger/test_init.py index b1948da9..640f67b9 100644 --- a/tests/logger/test_init.py +++ b/tests/logger/test_init.py @@ -77,23 +77,21 @@ def test_get_logger_for_server_when_given_cef_format_uses_cef_formatter(): logger = get_logger_for_server( "example.com", ServerProtocol.TCP, SendToFileEventsOutputFormat.CEF, None ) - assert type(logger.handlers[0].formatter) == FileEventDictToCEFFormatter + assert isinstance(logger.handlers[0].formatter, FileEventDictToCEFFormatter) def test_get_logger_for_server_when_given_json_format_uses_json_formatter(): logger = get_logger_for_server( "example.com", ServerProtocol.TCP, OutputFormat.JSON, None ) - actual = type(logger.handlers[0].formatter) - assert actual == FileEventDictToJSONFormatter + assert isinstance(logger.handlers[0].formatter, FileEventDictToJSONFormatter) def test_get_logger_for_server_when_given_raw_json_format_uses_raw_json_formatter(): logger = get_logger_for_server( "example.com", ServerProtocol.TCP, OutputFormat.RAW, None ) - actual = type(logger.handlers[0].formatter) - assert actual == FileEventDictToRawJSONFormatter + assert isinstance(logger.handlers[0].formatter, FileEventDictToRawJSONFormatter) def test_get_logger_for_server_when_called_twice_only_has_one_handler(): @@ -108,7 +106,7 @@ def test_get_logger_for_server_uses_no_priority_syslog_handler(): logger = get_logger_for_server( "example.com", ServerProtocol.TCP, SendToFileEventsOutputFormat.CEF, None ) - assert type(logger.handlers[0]) == NoPrioritySysLogHandler + assert isinstance(logger.handlers[0], NoPrioritySysLogHandler) def test_get_logger_for_server_constructs_handler_with_expected_args( diff --git a/tox.ini b/tox.ini index 9413bdf0..e8cea7f8 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist = - py{311,310,39,38,37} + py{312,311,310,39,38,37} docs style skip_missing_interpreters = true @@ -12,6 +12,7 @@ deps = pytest-cov == 4.0.0 pandas >= 1.1.3 pexpect == 4.8.0 + setuptools >= 66.0.0 commands = # -v: verbose