From 3e4ac63fc38e362da1317bf8e046129748289097 Mon Sep 17 00:00:00 2001 From: danimtb Date: Thu, 22 Aug 2024 13:02:12 +0200 Subject: [PATCH 01/13] test CI --- extensions/commands/art/cmd_build_info.py | 1 + 1 file changed, 1 insertion(+) diff --git a/extensions/commands/art/cmd_build_info.py b/extensions/commands/art/cmd_build_info.py index ca54fe9..461278c 100644 --- a/extensions/commands/art/cmd_build_info.py +++ b/extensions/commands/art/cmd_build_info.py @@ -17,6 +17,7 @@ from cmd_property import get_properties, set_properties from cmd_server import get_url_user_password +# test comment def get_buildinfo(build_name, build_number, url, user, password, project=None): request_url = f"{url}/api/build/{build_name}/{build_number}" From 23909fb396ebaed71702b0ab5d8d8ffcf809857e Mon Sep 17 00:00:00 2001 From: danimtb Date: Thu, 22 Aug 2024 13:18:56 +0200 Subject: [PATCH 02/13] try --- tests/test_artifactory_commands.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_artifactory_commands.py b/tests/test_artifactory_commands.py index 2142856..a8fe81a 100644 --- a/tests/test_artifactory_commands.py +++ b/tests/test_artifactory_commands.py @@ -43,8 +43,8 @@ def conan_test(): repo = os.path.join(os.path.dirname(__file__), "..") run(f"conan config install {repo}") - run("conan remove '*' -c -r extensions-stg") - run("conan remove '*' -c -r extensions-prod") + run("conan remove * -c -r extensions-stg") + run("conan remove * -c -r extensions-prod") try: yield From 7662fc81416f9c6158cc049f4a61ad6b980e9c4f Mon Sep 17 00:00:00 2001 From: danimtb Date: Thu, 22 Aug 2024 14:08:41 +0200 Subject: [PATCH 03/13] try --- tests/test_artifactory_commands.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_artifactory_commands.py b/tests/test_artifactory_commands.py index a8fe81a..a55dd32 100644 --- a/tests/test_artifactory_commands.py +++ b/tests/test_artifactory_commands.py @@ -232,8 +232,8 @@ def test_build_info_create_deps(): run(f'conan art:build-info delete {build_name}_aggregated --build-number={build_number} --url="{os.getenv("ART_URL")}" --user="{os.getenv("CONAN_LOGIN_USERNAME_EXTENSIONS_STG")}" --password="{os.getenv("CONAN_PASSWORD_EXTENSIONS_STG")}" --delete-all --delete-artifacts') -@pytest.mark.requires_credentials -def test_build_info_create_from_cached_deps(): +# @pytest.mark.requires_credentials +def __test_build_info_create_from_cached_deps(): # Make sure artifactory repos are empty before starting the test run("conan remove mypkg* -c -r extensions-stg") run("conan remove mypkg* -c -r extensions-prod") From af8e32f2899c884f5ec90b295e3c99acae89fbe3 Mon Sep 17 00:00:00 2001 From: danimtb Date: Thu, 22 Aug 2024 14:19:33 +0200 Subject: [PATCH 04/13] revert some changes --- extensions/commands/art/cmd_build_info.py | 1 - tests/test_artifactory_commands.py | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/extensions/commands/art/cmd_build_info.py b/extensions/commands/art/cmd_build_info.py index 461278c..ca54fe9 100644 --- a/extensions/commands/art/cmd_build_info.py +++ b/extensions/commands/art/cmd_build_info.py @@ -17,7 +17,6 @@ from cmd_property import get_properties, set_properties from cmd_server import get_url_user_password -# test comment def get_buildinfo(build_name, build_number, url, user, password, project=None): request_url = f"{url}/api/build/{build_name}/{build_number}" diff --git a/tests/test_artifactory_commands.py b/tests/test_artifactory_commands.py index a55dd32..b97a1e3 100644 --- a/tests/test_artifactory_commands.py +++ b/tests/test_artifactory_commands.py @@ -43,8 +43,8 @@ def conan_test(): repo = os.path.join(os.path.dirname(__file__), "..") run(f"conan config install {repo}") - run("conan remove * -c -r extensions-stg") - run("conan remove * -c -r extensions-prod") + run("conan remove '*' -c -r extensions-stg") + run("conan remove '*' -c -r extensions-prod") try: yield From 042a97c7131b488731bb34a47802e9e16d237741 Mon Sep 17 00:00:00 2001 From: danimtb Date: Thu, 22 Aug 2024 14:25:42 +0200 Subject: [PATCH 05/13] remove quotes --- tests/test_artifactory_commands.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_artifactory_commands.py b/tests/test_artifactory_commands.py index b97a1e3..a55dd32 100644 --- a/tests/test_artifactory_commands.py +++ b/tests/test_artifactory_commands.py @@ -43,8 +43,8 @@ def conan_test(): repo = os.path.join(os.path.dirname(__file__), "..") run(f"conan config install {repo}") - run("conan remove '*' -c -r extensions-stg") - run("conan remove '*' -c -r extensions-prod") + run("conan remove * -c -r extensions-stg") + run("conan remove * -c -r extensions-prod") try: yield From a55905c7364ab7be609f7e16b08aded0e945b858 Mon Sep 17 00:00:00 2001 From: danimtb Date: Thu, 22 Aug 2024 14:36:42 +0200 Subject: [PATCH 06/13] try run tests sequentially --- .github/workflows/test_conan_extensions.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_conan_extensions.yml b/.github/workflows/test_conan_extensions.yml index 19db4cc..354ebd4 100644 --- a/.github/workflows/test_conan_extensions.yml +++ b/.github/workflows/test_conan_extensions.yml @@ -25,7 +25,7 @@ jobs: pip install conan - name: Run tests - Conan latest / Python 3.8 run: | - pytest -v tests + pytest -n 0 -v tests - name: Install Conan develop run: | pip install git+https://github.com/conan-io/conan.git@release/2.0 @@ -47,4 +47,4 @@ jobs: pip install pytest conan - name: Run Windows-specific tests - Conan latest / Python 3.8 run: | - pytest -v -m win32 tests + pytest -n 0 -v -m win32 tests From 7cf4ef7dba4a69b7581972a8736b23540bae7961 Mon Sep 17 00:00:00 2001 From: danimtb Date: Thu, 22 Aug 2024 14:55:20 +0200 Subject: [PATCH 07/13] no xdist --- .github/workflows/test_conan_extensions.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test_conan_extensions.yml b/.github/workflows/test_conan_extensions.yml index 354ebd4..3af4619 100644 --- a/.github/workflows/test_conan_extensions.yml +++ b/.github/workflows/test_conan_extensions.yml @@ -25,13 +25,13 @@ jobs: pip install conan - name: Run tests - Conan latest / Python 3.8 run: | - pytest -n 0 -v tests + pytest -v -p no:xdist tests - name: Install Conan develop run: | pip install git+https://github.com/conan-io/conan.git@release/2.0 - name: Run tests - Conan develop / Python 3.8 run: | - pytest -v tests + pytest -v -p no:xdist tests conan_windows: runs-on: windows-latest @@ -47,4 +47,4 @@ jobs: pip install pytest conan - name: Run Windows-specific tests - Conan latest / Python 3.8 run: | - pytest -n 0 -v -m win32 tests + pytest -v -p no:xdist -m win32 tests From 09006e0af87cfab47bbbe517d5dd8a9d82058580 Mon Sep 17 00:00:00 2001 From: danimtb Date: Thu, 22 Aug 2024 15:12:44 +0200 Subject: [PATCH 08/13] try order --- tests/test_artifactory_commands.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/test_artifactory_commands.py b/tests/test_artifactory_commands.py index a55dd32..402c7e8 100644 --- a/tests/test_artifactory_commands.py +++ b/tests/test_artifactory_commands.py @@ -57,6 +57,7 @@ def conan_test(): @pytest.mark.requires_credentials +@pytest.mark.order(1) def test_build_info_create_no_deps(): build_name = "mybuildinfo" @@ -121,6 +122,7 @@ def test_build_info_create_no_deps(): @pytest.mark.requires_credentials +@pytest.mark.order(2) def test_build_info_create_with_build_url(): build_name = "mybuildinfo" @@ -141,6 +143,7 @@ def test_build_info_create_with_build_url(): @pytest.mark.requires_credentials +@pytest.mark.order(3) def test_build_info_create_deps(): # +-------+ # | libc | @@ -232,8 +235,9 @@ def test_build_info_create_deps(): run(f'conan art:build-info delete {build_name}_aggregated --build-number={build_number} --url="{os.getenv("ART_URL")}" --user="{os.getenv("CONAN_LOGIN_USERNAME_EXTENSIONS_STG")}" --password="{os.getenv("CONAN_PASSWORD_EXTENSIONS_STG")}" --delete-all --delete-artifacts') -# @pytest.mark.requires_credentials -def __test_build_info_create_from_cached_deps(): +@pytest.mark.requires_credentials +@pytest.mark.order(4) +def test_build_info_create_from_cached_deps(): # Make sure artifactory repos are empty before starting the test run("conan remove mypkg* -c -r extensions-stg") run("conan remove mypkg* -c -r extensions-prod") @@ -267,6 +271,7 @@ def __test_build_info_create_from_cached_deps(): @pytest.mark.requires_credentials +@pytest.mark.order(5) def test_fail_if_not_uploaded(): """ In order to create the Build Info we need the hashes of the artifacts that are uploaded @@ -287,6 +292,7 @@ def test_fail_if_not_uploaded(): @pytest.mark.requires_credentials +@pytest.mark.order(5) def test_build_info_project(): """ Test that build info is correctly manages using a project in Artifactory @@ -329,6 +335,7 @@ def test_build_info_project(): @pytest.mark.requires_credentials +@pytest.mark.order(7) def test_build_info_dependency_different_repo(): """ Test that build info is correctly generated for a package with dependencies in a different repo in Artifactory @@ -382,6 +389,7 @@ def test_build_info_dependency_different_repo(): @pytest.mark.requires_credentials +@pytest.mark.order(8) def test_server_complete(): """ Test server add, list, remove commands @@ -411,6 +419,7 @@ def test_server_complete(): @pytest.mark.requires_credentials +@pytest.mark.order(9) def test_server_add_error(): """ Test server add error when adding a server with same name @@ -434,6 +443,7 @@ def test_server_add_error(): @pytest.mark.requires_credentials +@pytest.mark.order(10) def test_server_remove_error(): """ Test server remove errors when there is no server with the provided name @@ -444,6 +454,7 @@ def test_server_remove_error(): @pytest.mark.requires_credentials +@pytest.mark.order(11) def test_server_list_empty(): """ Test server list output when no servers are configured @@ -454,6 +465,7 @@ def test_server_list_empty(): @pytest.mark.requires_credentials +@pytest.mark.order(12) def test_add_server_token(): """ Test server add with token From d3a476132812bb8bbd94eddf0dbc3ef53a89c1d1 Mon Sep 17 00:00:00 2001 From: danimtb Date: Thu, 22 Aug 2024 15:47:12 +0200 Subject: [PATCH 09/13] revert other changes --- .github/workflows/test_conan_extensions.yml | 6 +++--- tests/test_artifactory_commands.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test_conan_extensions.yml b/.github/workflows/test_conan_extensions.yml index 3af4619..19db4cc 100644 --- a/.github/workflows/test_conan_extensions.yml +++ b/.github/workflows/test_conan_extensions.yml @@ -25,13 +25,13 @@ jobs: pip install conan - name: Run tests - Conan latest / Python 3.8 run: | - pytest -v -p no:xdist tests + pytest -v tests - name: Install Conan develop run: | pip install git+https://github.com/conan-io/conan.git@release/2.0 - name: Run tests - Conan develop / Python 3.8 run: | - pytest -v -p no:xdist tests + pytest -v tests conan_windows: runs-on: windows-latest @@ -47,4 +47,4 @@ jobs: pip install pytest conan - name: Run Windows-specific tests - Conan latest / Python 3.8 run: | - pytest -v -p no:xdist -m win32 tests + pytest -v -m win32 tests diff --git a/tests/test_artifactory_commands.py b/tests/test_artifactory_commands.py index 402c7e8..2de3e77 100644 --- a/tests/test_artifactory_commands.py +++ b/tests/test_artifactory_commands.py @@ -43,8 +43,8 @@ def conan_test(): repo = os.path.join(os.path.dirname(__file__), "..") run(f"conan config install {repo}") - run("conan remove * -c -r extensions-stg") - run("conan remove * -c -r extensions-prod") + run("conan remove '*' -c -r extensions-stg") + run("conan remove '*' -c -r extensions-prod") try: yield From ec46ca0d9747268b664ccb91002c8e676e70d64e Mon Sep 17 00:00:00 2001 From: danimtb Date: Fri, 23 Aug 2024 10:16:46 +0200 Subject: [PATCH 10/13] install pytest-order --- .github/workflows/test_conan_extensions.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_conan_extensions.yml b/.github/workflows/test_conan_extensions.yml index 19db4cc..617f9cd 100644 --- a/.github/workflows/test_conan_extensions.yml +++ b/.github/workflows/test_conan_extensions.yml @@ -19,7 +19,7 @@ jobs: - name: Install dependencies run: | pip install -U pip - pip install pytest "cyclonedx-python-lib>=5.0.0,<6" + pip install pytest pytest-order "cyclonedx-python-lib>=5.0.0,<6" - name: Install Conan latest run: | pip install conan @@ -44,7 +44,7 @@ jobs: - name: Install dependencies and Conan latest run: | pip install -U pip - pip install pytest conan + pip install pytest pytest-order conan - name: Run Windows-specific tests - Conan latest / Python 3.8 run: | pytest -v -m win32 tests From c48625f642d79b4b596f2d0b9b734857c28b861d Mon Sep 17 00:00:00 2001 From: danimtb Date: Fri, 23 Aug 2024 10:18:59 +0200 Subject: [PATCH 11/13] add pytest.ini to avoid warnings on markers --- tests/pytest.ini | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 tests/pytest.ini diff --git a/tests/pytest.ini b/tests/pytest.ini new file mode 100644 index 0000000..73c9a90 --- /dev/null +++ b/tests/pytest.ini @@ -0,0 +1,3 @@ +[tool:pytest] +markers = + requires_credentials: mark tests that require credentials for Artifactory \ No newline at end of file From 8993759003842dbdcb88060146b4d3b3adc5f82d Mon Sep 17 00:00:00 2001 From: danimtb Date: Fri, 23 Aug 2024 10:28:15 +0200 Subject: [PATCH 12/13] move pytest.ini --- tests/pytest.ini => pytest.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename tests/pytest.ini => pytest.ini (86%) diff --git a/tests/pytest.ini b/pytest.ini similarity index 86% rename from tests/pytest.ini rename to pytest.ini index 73c9a90..9ef5afd 100644 --- a/tests/pytest.ini +++ b/pytest.ini @@ -1,3 +1,3 @@ -[tool:pytest] +[pytest] markers = requires_credentials: mark tests that require credentials for Artifactory \ No newline at end of file From 70d588c9dd87e5ce7a467871c76c9821a1b7ac79 Mon Sep 17 00:00:00 2001 From: danimtb Date: Fri, 23 Aug 2024 10:37:15 +0200 Subject: [PATCH 13/13] add win32 mark --- pytest.ini | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pytest.ini b/pytest.ini index 9ef5afd..c589722 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,3 +1,4 @@ [pytest] markers = - requires_credentials: mark tests that require credentials for Artifactory \ No newline at end of file + requires_credentials: mark tests that require credentials for Artifactory + win32: mark tests that should be run only on a Windows machine