Skip to content

Commit

Permalink
chore: Applying underscores decision
Browse files Browse the repository at this point in the history
No test name may contain two underscores between `test` and
the first alphanumeric character of a function name.

Signed-off-by: Alexey Ovchinnikov <[email protected]>
  • Loading branch information
a-ovchinnikov committed Jan 28, 2025
1 parent 3800b60 commit deeb45c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
8 changes: 4 additions & 4 deletions tests/unit/package_managers/bundler/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def test_get_main_package_name_and_version_from_repo_without_origin(
assert "Failed to extract package name from origin remote" in exc_info.value.friendly_msg()


def test__prepare_for_hermetic_build_injects_necessary_variable_into_empty_config(
def test_prepare_for_hermetic_build_injects_necessary_variable_into_empty_config(
rooted_tmp_path: RootedPath,
) -> None:
expected_config_location = rooted_tmp_path.join_within_root(".bundle/config").path
Expand All @@ -141,7 +141,7 @@ def test__prepare_for_hermetic_build_injects_necessary_variable_into_empty_confi
assert result.template == expected_config_contents


def test__prepare_for_hermetic_build_injects_necessary_variable_into_existing_config(
def test_prepare_for_hermetic_build_injects_necessary_variable_into_existing_config(
rooted_tmp_path: RootedPath,
) -> None:
expected_config_location = rooted_tmp_path.join_within_root(".bundle/config").path
Expand Down Expand Up @@ -173,7 +173,7 @@ def test__prepare_for_hermetic_build_injects_necessary_variable_into_existing_co
assert result.template == existing_preamble + expected_config_contents


def test__prepare_for_hermetic_build_injects_necessary_variable_into_existing_alternate_config(
def test_prepare_for_hermetic_build_injects_necessary_variable_into_existing_alternate_config(
rooted_tmp_path: RootedPath,
) -> None:
expected_alternate_config_location = rooted_tmp_path.join_within_root("alternate/config").path
Expand Down Expand Up @@ -210,7 +210,7 @@ def test__prepare_for_hermetic_build_injects_necessary_variable_into_existing_al
assert result.template == existing_preamble + expected_alternate_config_contents


def test__prepare_for_hermetic_build_ignores_a_directory_in_place_of_config(
def test_prepare_for_hermetic_build_ignores_a_directory_in_place_of_config(
rooted_tmp_path: RootedPath,
) -> None:
expected_config_location = rooted_tmp_path.join_within_root(".bundle/config").path
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/package_managers/test_gomod.py
Original file line number Diff line number Diff line change
Expand Up @@ -2455,7 +2455,7 @@ class TestGoWork:
],
)
@mock.patch("cachi2.core.package_managers.gomod.run_cmd")
def test__init__(
def test_init__(
self,
mock_run: mock.Mock,
rooted_tmp_path: RootedPath,
Expand All @@ -2474,7 +2474,7 @@ def test__init__(
assert go_work.data == {}

@mock.patch("cachi2.core.package_managers.gomod.run_cmd")
def test__init__fail(self, mock_run: mock.Mock, rooted_tmp_path: RootedPath) -> None:
def test_init__fail(self, mock_run: mock.Mock, rooted_tmp_path: RootedPath) -> None:
mock_run.return_value = "/a/random/path/go.work"
with pytest.raises(PathOutsideRoot):
GoWork(rooted_tmp_path)
Expand All @@ -2487,7 +2487,7 @@ def test__init__fail(self, mock_run: mock.Mock, rooted_tmp_path: RootedPath) ->
],
)
@mock.patch("cachi2.core.package_managers.gomod.run_cmd")
def test__bool__(
def test_bool__(
self, mock_run: mock.Mock, rooted_tmp_path: RootedPath, go_work_env: str, expected: bool
) -> None:
if go_work_env:
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/package_managers/test_rpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,6 @@ def test_write(
pytest.param(False, ssl.CERT_NONE, id="host_verification_disabled_when_verify_false"),
],
)
def test__get_ssl_context_verify_mode(ssl_verify: bool, expected_mode: int) -> None:
def test_get_ssl_context_verify_mode(ssl_verify: bool, expected_mode: int) -> None:
ssl_context = _get_ssl_context(SSLOptions(ssl_verify=ssl_verify))
assert ssl_context.verify_mode is expected_mode
20 changes: 10 additions & 10 deletions tests/unit/package_managers/yarn_classic/test_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,22 +77,22 @@


@pytest.mark.parametrize("url", VALID_TARBALL_URLS)
def test__is_tarball_url_can_parse_correct_tarball_urls(url: str) -> None:
def test_is_tarball_url_can_parse_correct_tarball_urls(url: str) -> None:
assert _is_tarball_url(url)


@pytest.mark.parametrize("url", INVALID_TARBALL_URLS)
def test__is_tarball_url_rejects_incorrect_tarball_urls(url: str) -> None:
def test_is_tarball_url_rejects_incorrect_tarball_urls(url: str) -> None:
assert not _is_tarball_url(url)


@pytest.mark.parametrize("url", VALID_GIT_URLS)
def test__is_git_url_can_parse_correct_git_urls(url: str) -> None:
def test_is_git_url_can_parse_correct_git_urls(url: str) -> None:
assert _is_git_url(url)


@pytest.mark.parametrize("url", INVALID_GIT_URLS)
def test__is_git_url_rejects_incorrect_git_urls(url: str) -> None:
def test_is_git_url_rejects_incorrect_git_urls(url: str) -> None:
assert not _is_git_url(url)


Expand All @@ -103,11 +103,11 @@ def test__is_git_url_rejects_incorrect_git_urls(url: str) -> None:
"https://registry.yarnpkg.com/chai/-/chai-4.2.0.tgz",
],
)
def test__is_from_npm_registry_can_parse_correct_registry_urls(url: str) -> None:
def test_is_from_npm_registry_can_parse_correct_registry_urls(url: str) -> None:
assert _is_from_npm_registry(url)


def test__is_from_npm_registry_can_parse_incorrect_registry_urls() -> None:
def test_is_from_npm_registry_can_parse_incorrect_registry_urls() -> None:
assert not _is_from_npm_registry("https://example.org/fecha.tar.gz")


Expand Down Expand Up @@ -246,7 +246,7 @@ def test_create_package_from_pyarn_package_fail_unexpected_format(
@mock.patch(
"cachi2.core.package_managers.yarn_classic.resolver._YarnClassicPackageFactory.create_package_from_pyarn_package"
)
def test__get_packages_from_lockfile(
def test_get_packages_from_lockfile(
mock_create_package: mock.Mock, rooted_tmp_path: RootedPath
) -> None:
# Setup lockfile instance
Expand Down Expand Up @@ -316,7 +316,7 @@ def test_resolve_packages(
assert list(output) == expected_output


def test__get_main_package(rooted_tmp_path: RootedPath) -> None:
def test_get_main_package(rooted_tmp_path: RootedPath) -> None:
package_json = PackageJson(
_path=rooted_tmp_path.join_within_root("package.json"),
_data={"name": "foo", "version": "1.0.0"},
Expand All @@ -331,7 +331,7 @@ def test__get_main_package(rooted_tmp_path: RootedPath) -> None:
assert output == expected_output


def test__get_main_package_no_name(rooted_tmp_path: RootedPath) -> None:
def test_get_main_package_no_name(rooted_tmp_path: RootedPath) -> None:
package_json = PackageJson(
_path=rooted_tmp_path.join_within_root("package.json"),
_data={},
Expand All @@ -344,7 +344,7 @@ def test__get_main_package_no_name(rooted_tmp_path: RootedPath) -> None:
_get_main_package(rooted_tmp_path, package_json)


def test__get_workspace_packages(rooted_tmp_path: RootedPath) -> None:
def test_get_workspace_packages(rooted_tmp_path: RootedPath) -> None:
workspace_path = rooted_tmp_path.join_within_root("foo")
workspace_path.path.mkdir()

Expand Down

0 comments on commit deeb45c

Please sign in to comment.