diff --git a/.chasten/checks.yml b/.chasten/checks.yml index e28eeff3..7394f743 100644 --- a/.chasten/checks.yml +++ b/.chasten/checks.yml @@ -5,32 +5,32 @@ checks: pattern: './/ClassDef' count: min: 1 - max: 50 + max: null - name: "all-function-definition" code: "AFD" id: "F001" pattern: './/FunctionDef' count: min: 1 - max: 200 - - name: "non-test-function-definition" + max: null + - name: "dummy-test-non-test-function-definition" code: "NTF" id: "F002" pattern: './/FunctionDef[not(contains(@name, "test_"))]' count: - min: 40 - max: 70 - - name: "single-nested-if" + min: null + max: null + - name: "dummy-test-single-nested-if" code: "SNI" id: "CL001" pattern: './/FunctionDef/body//If' count: - min: 1 - max: 100 - - name: "double-nested-if" + min: null + max: null + - name: "dummy-test-double-nested-if" code: "DNI" id: "CL002" pattern: './/FunctionDef/body//If[ancestor::If and not(parent::orelse)]' count: - min: 1 - max: 15 \ No newline at end of file + min: null + max: null diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 60f17e62..2b9d09e2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -53,7 +53,7 @@ jobs: - name: Install Pip if: always() run: | - pip install -U pip + python -m pip install --upgrade pip # Install poetry - name: Install Poetry if: always() diff --git a/tests/test_constants.py b/tests/test_constants.py index d86f2c42..b914e588 100644 --- a/tests/test_constants.py +++ b/tests/test_constants.py @@ -1,6 +1,7 @@ """Pytest test suite for the constants module.""" from dataclasses import FrozenInstanceError +from pathlib import Path import pytest from hypothesis import given, strategies @@ -44,7 +45,7 @@ def test_fuzz_init(directory, configfile, checksfile, extra, yes, no): # noqa: def test_fuzz_immutable(fs, hr): """Use Hypothesis to confirm that attribute's value cannot be re-assigned.""" with pytest.raises(FrozenInstanceError): - fs.Current_Directory = "/new/path" + fs.Current_Directory = str(Path("/new") / Path("path")) with pytest.raises(FrozenInstanceError): hr.Yes = "YES" with pytest.raises(FrozenInstanceError): diff --git a/tests/test_filesystem.py b/tests/test_filesystem.py index 691e81e1..ac3289f3 100644 --- a/tests/test_filesystem.py +++ b/tests/test_filesystem.py @@ -1,6 +1,7 @@ """Pytest test suite for the filesystem module.""" import pathlib +from pathlib import Path from unittest.mock import patch import pytest @@ -12,7 +13,7 @@ def test_valid_directory() -> None: """Confirm that a valid directory is found.""" - directory_str = "./tests/" + directory_str = str(Path("./tests/")) directory = pathlib.Path(directory_str) confirmation = filesystem.confirm_valid_directory(directory) assert confirmation is True @@ -20,7 +21,7 @@ def test_valid_directory() -> None: def test_invalid_directory() -> None: """Confirm that a valid directory is found.""" - directory_str = "./testsNOT/" + directory_str = str(Path("./testsNOT/")) directory = pathlib.Path(directory_str) confirmation = filesystem.confirm_valid_directory(directory) assert confirmation is False @@ -28,7 +29,7 @@ def test_invalid_directory() -> None: def test_valid_file() -> None: """Confirm that a valid directory is found.""" - file_str = "./tests/test_filesystem.py" + file_str = str(Path("./tests") / Path("test_filesystem.py")) this_file = pathlib.Path(file_str) confirmation = filesystem.confirm_valid_file(this_file) assert confirmation is True @@ -36,7 +37,7 @@ def test_valid_file() -> None: def test_invalid_file() -> None: """Confirm that a valid directory is found.""" - file_str = "./tests/test_filesystemNOT.py" + file_str = str(Path("./tests") / Path("test_filesystemNOT.py.py")) this_file_not = pathlib.Path(file_str) confirmation = filesystem.confirm_valid_file(this_file_not) assert confirmation is False diff --git a/tests/test_main.py b/tests/test_main.py index 17504aae..0b0783c0 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -54,7 +54,7 @@ pattern: './/ClassDef' count: min: 1 - max: 10 + max: null - name: "all-function-definition" code: "AFD" id: "F001" @@ -91,7 +91,7 @@ def test_cli_analyze_correct_arguments_nothing_to_analyze_not_looking(tmpdir): project_name = "testing" # create a reference to the internal # .chasten directory that supports testing - configuration_directory = test_one + "/.chasten" + configuration_directory = test_one / Path(".chasten") configuration_directory_path = Path(configuration_directory) configuration_directory_path.mkdir() configuration_file = configuration_directory_path / "config.yml" @@ -122,7 +122,7 @@ def test_cli_analyze_correct_arguments_analyze_chasten_codebase(cwd): project_name = "testing" # create a reference to the internal # .chasten directory that supports testing - configuration_directory = str(cwd) + "/.chasten" + configuration_directory = cwd / Path(".chasten") result = runner.invoke( main.cli, [ @@ -144,7 +144,7 @@ def test_cli_analyze_incorrect_arguments_no_project(cwd, tmpdir): test_one = tmpdir.mkdir("test_one") # create a reference to the internal # .chasten directory that supports testing - configuration_directory = str(cwd) + "/.chasten" + configuration_directory = cwd / Path(".chasten") # call the analyze command result = runner.invoke( main.cli, @@ -297,7 +297,7 @@ def test_fuzz_cli_analyze_single_directory(cwd, directory): project_name = "testing" # create a reference to the internal # .chasten directory that supports testing - configuration_directory = str(cwd) + "/.chasten" + configuration_directory = cwd / Path(".chasten") result = runner.invoke( main.cli, [