From 86fb692ded042ab72a33d1539bec63ca16590f49 Mon Sep 17 00:00:00 2001 From: Yanks Yoon <37652070+yanksyoon@users.noreply.github.com> Date: Wed, 15 Nov 2023 18:50:25 +0800 Subject: [PATCH] chore: rename fixtures for clarity (#61) Co-authored-by: arturo-seijas <102022572+arturo-seijas@users.noreply.github.com> --- tests/integration/conftest.py | 16 ++++++++-------- tests/integration/test_k8s_agent.py | 2 +- tests/integration/test_machine_agent.py | 4 ++-- tests/integration/test_plugins.py | 6 +++--- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 61cd3332..004cb128 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -175,8 +175,8 @@ async def jenkins_k8s_agents_fixture( await model.remove_application(agent_app.name, block_until_done=True, force=True) -@pytest_asyncio.fixture(scope="function", name="app_k8s_agent_related") -async def app_k8s_agent_related_fixture( +@pytest_asyncio.fixture(scope="function", name="k8s_agent_related_app") +async def k8s_agent_related_app_fixture( jenkins_k8s_agents: Application, application: Application, ): @@ -207,8 +207,8 @@ async def extra_jenkins_k8s_agents_fixture( yield agent_app -@pytest_asyncio.fixture(scope="function", name="app_k8s_deprecated_agent_related") -async def app_k8s_deprecated_agent_related_fixture( +@pytest_asyncio.fixture(scope="function", name="k8s_deprecated_agent_related_app") +async def k8s_deprecated_agent_related_app_fixture( jenkins_k8s_agents: Application, application: Application, ): @@ -269,8 +269,8 @@ async def jenkins_machine_agents_fixture( yield app -@pytest_asyncio.fixture(scope="function", name="app_machine_agent_related") -async def app_machine_agent_related_fixture( +@pytest_asyncio.fixture(scope="function", name="machine_agent_related_app") +async def machine_agent_related_app_fixture( jenkins_machine_agents: Application, application: Application, ): @@ -292,8 +292,8 @@ async def app_machine_agent_related_fixture( yield application -@pytest_asyncio.fixture(scope="function", name="app_machine_deprecated_agent_related") -async def app_machine_deprecated_agent_related_fixture( +@pytest_asyncio.fixture(scope="function", name="machine_deprecated_agent_related_app") +async def machine_deprecated_agent_related_app_fixture( jenkins_machine_agents: Application, application: Application, ): diff --git a/tests/integration/test_k8s_agent.py b/tests/integration/test_k8s_agent.py index 0ab498fb..1239199e 100644 --- a/tests/integration/test_k8s_agent.py +++ b/tests/integration/test_k8s_agent.py @@ -82,7 +82,7 @@ async def test_jenkins_k8s_agent_relation( ) -@pytest.mark.usefixtures("app_k8s_deprecated_agent_related") +@pytest.mark.usefixtures("k8s_deprecated_agent_related_app") async def test_jenkins_k8s_deprecated_agent_relation( jenkins_k8s_agents: Application, jenkins_client: jenkinsapi.jenkins.Jenkins ): diff --git a/tests/integration/test_machine_agent.py b/tests/integration/test_machine_agent.py index 8d2fe034..2967eca5 100644 --- a/tests/integration/test_machine_agent.py +++ b/tests/integration/test_machine_agent.py @@ -29,7 +29,7 @@ async def test_jenkins_machine_agent_relation( # 1. Relate jenkins-k8s charm to the jenkins-agent charm. model = application.model machine_model = jenkins_machine_agents.model - # this code is similar to the app_machine_agent_related fixture but shouldn't be using the + # this code is similar to the machine_agent_related_app fixture but shouldn't be using the # fixture since this test tests for teardown of relation as well. # pylint: disable=duplicate-code await model.relate( @@ -52,7 +52,7 @@ async def test_jenkins_machine_agent_relation( assert not any((application.name in key for key in jenkins_client.get_nodes().keys())) -@pytest.mark.usefixtures("app_machine_deprecated_agent_related") +@pytest.mark.usefixtures("machine_deprecated_agent_related_app") async def test_jenkins_machine_deprecated_agent_relation( jenkins_machine_agents: Application, jenkins_client: jenkinsapi.jenkins.Jenkins ): diff --git a/tests/integration/test_plugins.py b/tests/integration/test_plugins.py index af6fdcc6..fe12883d 100644 --- a/tests/integration/test_plugins.py +++ b/tests/integration/test_plugins.py @@ -51,7 +51,7 @@ async def test_jenkins_plugins_config( assert all(unit_web_client.client.has_plugin(plugin) for plugin in ALLOWED_PLUGINS) -@pytest.mark.usefixtures("app_k8s_agent_related") +@pytest.mark.usefixtures("k8s_agent_related_app") async def test_git_plugin_k8s_agent(ops_test: OpsTest, unit_web_client: UnitWebClient): """ arrange: given a jenkins charm with git plugin installed. @@ -185,7 +185,7 @@ async def test_matrix_combinations_parameter_plugin( ), f"Configuration matrix table not found, {test_page}" -@pytest.mark.usefixtures("app_k8s_agent_related") +@pytest.mark.usefixtures("k8s_agent_related_app") async def test_postbuildscript_plugin( ops_test: OpsTest, unit_web_client: UnitWebClient, jenkins_k8s_agents: Application ): @@ -289,7 +289,7 @@ async def test_thinbackup_plugin(ops_test: OpsTest, unit_web_client: UnitWebClie assert "FULL" in stdout, "The backup folder of format FULL- not found." -@pytest.mark.usefixtures("app_k8s_agent_related") +@pytest.mark.usefixtures("k8s_agent_related_app") async def test_rebuilder_plugin(ops_test: OpsTest, unit_web_client: UnitWebClient): """ arrange: given a Jenkins charm with rebuilder plugin installed.