# HG changeset patch # User Georges Racinet <georges.racinet@octobus.net> # Date 1664280793 -7200 # Tue Sep 27 14:13:13 2022 +0200 # Branch stable # Node ID 0bf9e86509b05f99ef88dfd077810285c58fd31f # Parent fe713f98aa8607f12caa3c897543692e6c901359 Importability refactoring: updated all imports from `.utils` They are now replaced by imports from `heptapod_tests`, which fixes all the resulting deprecation warnings. diff --git a/tests/test_backups.py b/tests/test_backups.py --- a/tests/test_backups.py +++ b/tests/test_backups.py @@ -1,16 +1,17 @@ import pytest -from . import needs -from .utils import ( - unique_name, -) -from .utils.group import Group -from .utils.hg import LocalRepo -from .utils.merge_request import MergeRequest -from .utils.project import ( +from heptapod_tests.namespace import Group +from heptapod_tests.hg import LocalRepo +from heptapod_tests.merge_request import MergeRequest +from heptapod_tests.project import ( Project, extract_gitlab_branch_titles, ) +from heptapod_tests.utils import ( + unique_name, +) + +from . import needs parametrize = pytest.mark.parametrize diff --git a/tests/test_bookmarks.py b/tests/test_bookmarks.py --- a/tests/test_bookmarks.py +++ b/tests/test_bookmarks.py @@ -1,5 +1,5 @@ -from .utils.hg import LocalRepo -from .utils.project import ( +from heptapod_tests.hg import LocalRepo +from heptapod_tests.project import ( branch_title, ) diff --git a/tests/test_closed_branch.py b/tests/test_closed_branch.py --- a/tests/test_closed_branch.py +++ b/tests/test_closed_branch.py @@ -1,7 +1,7 @@ import re +from heptapod_tests.hg import LocalRepo from . import needs -from .utils.hg import LocalRepo def test_push_branch_then_close(test_project, tmpdir): diff --git a/tests/test_groups.py b/tests/test_groups.py --- a/tests/test_groups.py +++ b/tests/test_groups.py @@ -1,12 +1,13 @@ import pytest from . import needs -from .utils import ( + +from heptapod_tests.access_levels import GroupAccess +from heptapod_tests.namespace import Group +from heptapod_tests.project import Project +from heptapod_tests.user import User +from heptapod_tests.utils import ( unique_name, ) -from .utils.access import GroupAccess -from .utils.group import Group -from .utils.project import Project -from .utils.user import User from .test_push import prepare_simple_repo diff --git a/tests/test_hg_access.py b/tests/test_hg_access.py --- a/tests/test_hg_access.py +++ b/tests/test_hg_access.py @@ -1,6 +1,6 @@ """Various permission related tests that don't fit elsewhere.""" -from .utils.hg import LocalRepo +from heptapod_tests.hg import LocalRepo def test_deploy_token(test_project, public_project, tmpdir): diff --git a/tests/test_import.py b/tests/test_import.py --- a/tests/test_import.py +++ b/tests/test_import.py @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- import pytest -from .utils import unique_name -from .utils.hg import ( +from heptapod_tests.hg import ( assert_matching_changesets, LocalRepo, ) -from .utils.project import Project +from heptapod_tests.project import Project +from heptapod_tests.utils import unique_name parametrize = pytest.mark.parametrize diff --git a/tests/test_instance.py b/tests/test_instance.py --- a/tests/test_instance.py +++ b/tests/test_instance.py @@ -2,8 +2,8 @@ import re -from .utils import unique_name -from .utils.user import User +from heptapod_tests.user import User +from heptapod_tests.utils import unique_name DOTTED_VERSION_RE = r'\d+\.\d+(\.\d+)?' diff --git a/tests/test_multiple_heads.py b/tests/test_multiple_heads.py --- a/tests/test_multiple_heads.py +++ b/tests/test_multiple_heads.py @@ -1,4 +1,4 @@ -from .utils.hg import LocalRepo +from heptapod_tests.hg import LocalRepo def test_push_multiple_heads_merge(test_project, tmpdir): diff --git a/tests/test_project_mirror.py b/tests/test_project_mirror.py --- a/tests/test_project_mirror.py +++ b/tests/test_project_mirror.py @@ -6,7 +6,7 @@ # SPDX-License-Identifier: GPL-2.0-or-later import pytest -from .utils.hg import LocalRepo, assert_matching_changesets +from heptapod_tests.hg import LocalRepo, assert_matching_changesets from .test_import import prepare_import_source parametrize = pytest.mark.parametrize diff --git a/tests/test_projects.py b/tests/test_projects.py --- a/tests/test_projects.py +++ b/tests/test_projects.py @@ -7,21 +7,22 @@ from selenium.webdriver.common.by import By import tarfile -from . import needs -from .utils import ( +from heptapod_tests.utils import ( unique_name, ) -from .utils.access import GroupAccess -from .utils.project import ( +from heptapod_tests.access_levels import GroupAccess +from heptapod_tests.project import ( Project, ) -from .utils.group import Group -from .utils.hg import LocalRepo -from .utils.selenium import ( +from heptapod_tests.namespace import Group +from heptapod_tests.hg import LocalRepo +from heptapod_tests.selenium import ( wait_could_click_element, webdriver_wait, ) +from . import needs + parametrize = pytest.mark.parametrize diff --git a/tests/test_prune.py b/tests/test_prune.py --- a/tests/test_prune.py +++ b/tests/test_prune.py @@ -2,7 +2,7 @@ This is not about pruning GitLab branches as a result of pushes. """ -from .utils.hg import LocalRepo +from heptapod_tests.hg import LocalRepo def test_prune_inside_topic(test_project, tmpdir): diff --git a/tests/test_public.py b/tests/test_public.py --- a/tests/test_public.py +++ b/tests/test_public.py @@ -1,5 +1,5 @@ import subprocess -from .utils.hg import LocalRepo +from heptapod_tests.hg import LocalRepo def test_public(public_project, tmpdir): diff --git a/tests/test_publish.py b/tests/test_publish.py --- a/tests/test_publish.py +++ b/tests/test_publish.py @@ -1,5 +1,5 @@ from heptapod_tests.access_levels import ProjectAccess -from .utils.hg import LocalRepo +from heptapod_tests.hg import LocalRepo def test_publish_perms(test_project, tmpdir): diff --git a/tests/test_pull.py b/tests/test_pull.py --- a/tests/test_pull.py +++ b/tests/test_pull.py @@ -1,8 +1,9 @@ -from . import needs -from .utils.hg import LocalRepo +from heptapod_tests.hg import LocalRepo # TODO make a fixture from that: from .test_push import prepare_simple_repo +from . import needs + ENABLE_CONFIG_EXPRESS = ('--config', 'extensions.configexpress=') DISABLE_CONFIG_EXPRESS = ('--config', 'extensions.configexpress=!') diff --git a/tests/test_python_gitlab.py b/tests/test_python_gitlab.py --- a/tests/test_python_gitlab.py +++ b/tests/test_python_gitlab.py @@ -1,7 +1,7 @@ """Tests involving the python-gitlab API client library.""" from .test_push import prepare_simple_repo -from .utils.git import LocalRepo as GitRepo +from heptapod_tests.git import LocalRepo as GitRepo def test_python_gitlab_hg_project(test_project, tmpdir): diff --git a/tests/test_repo_files.py b/tests/test_repo_files.py --- a/tests/test_repo_files.py +++ b/tests/test_repo_files.py @@ -10,11 +10,11 @@ from heptapod_tests.access_levels import ProjectAccess -from .utils.hg import LocalRepo -from .utils.project import ( +from heptapod_tests.hg import LocalRepo +from heptapod_tests.project import ( branch_title, ) -from .utils.selenium import ( +from heptapod_tests.selenium import ( wait_could_click_element, ) diff --git a/tests/test_runner.py b/tests/test_runner.py --- a/tests/test_runner.py +++ b/tests/test_runner.py @@ -4,9 +4,9 @@ from selenium.webdriver.common.by import By from . import suitable -from .utils.hg import LocalRepo +from heptapod_tests.hg import LocalRepo from heptapod_tests.runner import Runner -from .utils.selenium import ( +from heptapod_tests.selenium import ( webdriver_wait, ) diff --git a/tests/test_snippets.py b/tests/test_snippets.py --- a/tests/test_snippets.py +++ b/tests/test_snippets.py @@ -1,4 +1,4 @@ -from .utils.git import LocalRepo as GitRepo +from heptapod_tests.git import LocalRepo as GitRepo def test_project_snippets(test_project, tmpdir): diff --git a/tests/test_topics.py b/tests/test_topics.py --- a/tests/test_topics.py +++ b/tests/test_topics.py @@ -2,8 +2,7 @@ from urllib.parse import parse_qs from heptapod_tests.access_levels import ProjectAccess - -from .utils.hg import LocalRepo +from heptapod_tests.hg import LocalRepo parametrize = pytest.mark.parametrize diff --git a/tests/test_wikis.py b/tests/test_wikis.py --- a/tests/test_wikis.py +++ b/tests/test_wikis.py @@ -1,7 +1,7 @@ from selenium.webdriver.common.by import By -from .utils.hg import LocalRepo -from .utils.selenium import ( +from heptapod_tests.hg import LocalRepo +from heptapod_tests.selenium import ( wait_element_visible, ) # HG changeset patch # User Georges Racinet <georges.racinet@octobus.net> # Date 1664282083 -7200 # Tue Sep 27 14:34:43 2022 +0200 # Branch stable # Node ID 008a62476e9ec5cc5845de45644558faa6a8a07f # Parent 0bf9e86509b05f99ef88dfd077810285c58fd31f Importability: removed compatibility reexports This is the end of the line for `tests.utils`, see you in `heptapod_tests` diff --git a/tests/utils/__init__.py b/tests/utils/__init__.py deleted file mode 100644 --- a/tests/utils/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -import warnings - -# reexports for backwards compat -from heptapod_tests.utils import ( # noqa: F401 - unique_name, - assert_message, -) -from heptapod_tests.wait import ( # noqa: F401 - BASE_TIMEOUT, - log_base_timeout, - wait_assert, -) -from heptapod_tests import selenium # noqa: F401 -from heptapod_tests.selenium import assert_webdriver_not_error # noqa: F401 - - -warnings.warn("tests.utils is deprecated, please import from the " - "heptapod_tests package or the `selenium` module instead.", - DeprecationWarning, stacklevel=2) diff --git a/tests/utils/access.py b/tests/utils/access.py deleted file mode 100644 --- a/tests/utils/access.py +++ /dev/null @@ -1,13 +0,0 @@ -import warnings - -# reexports for backwards compat -from heptapod_tests.access_levels import ( # noqa: F401 - Access, - ProjectAccess, - GroupAccess, -) - - -warnings.warn("tests.utils.access is deprecated, please import from " - "heptapod_tests.access_levels instead", - DeprecationWarning, stacklevel=2) diff --git a/tests/utils/api.py b/tests/utils/api.py deleted file mode 100644 --- a/tests/utils/api.py +++ /dev/null @@ -1,11 +0,0 @@ -import warnings - -# reexports for backwards compat -from heptapod_tests.api import ( # noqa: F401 - api_request, - GitLabEntity, -) - -warnings.warn("tests.utils.api is deprecated, please import from " - "heptapod_tests.api instead", - DeprecationWarning, stacklevel=2) diff --git a/tests/utils/docker.py b/tests/utils/docker.py deleted file mode 100644 --- a/tests/utils/docker.py +++ /dev/null @@ -1,15 +0,0 @@ -import warnings - -# reexports for backwards compat -from heptapod_tests.docker import ( # noqa: F401 - heptapod_exec, - heptapod_run_shell, - heptapod_put_archive, - heptapod_put_archive_bin, - heptapod_get_archive, - host_address, -) - -warnings.warn("tests.utils.docker is deprecated, please import from " - "heptapod_tests instead", - DeprecationWarning, stacklevel=2) diff --git a/tests/utils/git.py b/tests/utils/git.py deleted file mode 100644 --- a/tests/utils/git.py +++ /dev/null @@ -1,12 +0,0 @@ -import warnings - -# reexports for backwards compat -from heptapod_tests.git import ( # noqa: F401 - LocalRepo, - git_call, -) - - -warnings.warn("tests.utils.git is deprecated, please import from " - "heptapod_tests.git instead", - DeprecationWarning, stacklevel=2) diff --git a/tests/utils/group.py b/tests/utils/group.py deleted file mode 100644 --- a/tests/utils/group.py +++ /dev/null @@ -1,13 +0,0 @@ -import warnings - -# reexports for backwards compat -from heptapod_tests.namespace import ( # noqa: F401 - Group, - NameSpace, - UserNameSpace, -) - - -warnings.warn("tests.utils.group is deprecated, please import from " - "heptapod_tests.namespace instead", - DeprecationWarning, stacklevel=2) diff --git a/tests/utils/heptapod.py b/tests/utils/heptapod.py deleted file mode 100644 --- a/tests/utils/heptapod.py +++ /dev/null @@ -1,15 +0,0 @@ -import warnings - -# reexports for backwards compat -from heptapod_tests.heptapod import ( # noqa: F401 - Heptapod, - ProductionHeptapod, - OmnibusHeptapod, - DockerHeptapod, - SourceHeptapod, - GdkHeptapod, -) - -warnings.warn("tests.utils.heptapod is deprecated, please import from " - "heptapod_tests instead", - DeprecationWarning, stacklevel=2) diff --git a/tests/utils/hg.py b/tests/utils/hg.py deleted file mode 100644 --- a/tests/utils/hg.py +++ /dev/null @@ -1,15 +0,0 @@ -import warnings - -# reexports for backwards compat -from heptapod_tests.hg import ( # noqa: F401 - LocalRepo, - assert_matching_changesets, - cli_pushvars, - hg_call, - hg_client_version, -) - - -warnings.warn("tests.utils.hg is deprecated, please import from " - "heptapod_tests.hg instead", - DeprecationWarning, stacklevel=2) diff --git a/tests/utils/merge_request.py b/tests/utils/merge_request.py deleted file mode 100644 --- a/tests/utils/merge_request.py +++ /dev/null @@ -1,11 +0,0 @@ -import warnings - -# reexports for backwards compat -from heptapod_tests.merge_request import ( # noqa: F401 - MergeRequest, -) - - -warnings.warn("tests.utils.merge_request is deprecated, please import from " - "heptapod_tests instead", - DeprecationWarning, stacklevel=2) diff --git a/tests/utils/project.py b/tests/utils/project.py deleted file mode 100644 --- a/tests/utils/project.py +++ /dev/null @@ -1,13 +0,0 @@ -import warnings - -# reexports for backwards compat -from heptapod_tests.project import ( # noqa: F401 - Project, - extract_gitlab_branch_titles, - branch_title, - protected_branch_api_subpath, -) - -warnings.warn("tests.utils.project is deprecated, please import from " - "heptapod_tests instead", - DeprecationWarning, stacklevel=2) diff --git a/tests/utils/project_mirror.py b/tests/utils/project_mirror.py deleted file mode 100644 --- a/tests/utils/project_mirror.py +++ /dev/null @@ -1,10 +0,0 @@ -import warnings - -# reexports for backwards compat -from heptapod_tests.project_mirror import ( # noqa: F401 - ProjectMirror, -) - -warnings.warn("tests.utils.project_mirror is deprecated, please import from " - "heptapod_tests instead", - DeprecationWarning, stacklevel=2) diff --git a/tests/utils/selenium.py b/tests/utils/selenium.py deleted file mode 100644 --- a/tests/utils/selenium.py +++ /dev/null @@ -1,19 +0,0 @@ -import warnings - -# reexports for backwards compat -from heptapod_tests.selenium import ( # noqa: F401 - page_means_not_ready, - raw_page_content, - webdriver_wait_get, - could_click_element, - webdriver_wait, - wait_could_click_element, - wait_element_visible, - wait_assert_in_page_source, - assert_webdriver_not_error, -) - - -warnings.warn("tests.utils.selenium is deprecated, please import from " - "heptapod_tests.selenium instead", - DeprecationWarning, stacklevel=2) diff --git a/tests/utils/session.py b/tests/utils/session.py deleted file mode 100644 --- a/tests/utils/session.py +++ /dev/null @@ -1,15 +0,0 @@ -import warnings - -# reexports for backwards compat -from heptapod_tests.session import ( # noqa: F401 - initialize_root, - finalize_password, - sign_in_page_login, - sign_in_page_clever_cloud_login, - page_is_password_setup, - login_as_root, -) - -warnings.warn("tests.utils.session is deprecated, please import from " - "heptapod_tests instead", - DeprecationWarning, stacklevel=2) diff --git a/tests/utils/user.py b/tests/utils/user.py deleted file mode 100644 --- a/tests/utils/user.py +++ /dev/null @@ -1,11 +0,0 @@ -import warnings - -# reexports for backwards compat -from heptapod_tests.user import ( # noqa: F401 - default_password, - User, -) - -warnings.warn("tests.utils.user is deprecated, please import from " - "heptapod_tests instead", - DeprecationWarning, stacklevel=2)