From 4d37809676b66296dd3924311ecd495b16b7fb39 Mon Sep 17 00:00:00 2001 From: Brett Holman Date: Tue, 7 Dec 2021 11:02:24 -0700 Subject: [PATCH 1/4] Remove non-deterministic test parameter This breaks parallel test execution via xdist. --- tests/unittests/test_util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unittests/test_util.py b/tests/unittests/test_util.py index 1290cbc69f1..f35ca12001d 100644 --- a/tests/unittests/test_util.py +++ b/tests/unittests/test_util.py @@ -976,7 +976,7 @@ class TestReadCcFromCmdline: "cmdline,expected_cfg", [ # Return None if cmdline has no cc:end_cc content. - (CiTestCase.random_string(), None), + ('cmdline has no cc content', None), # Return None if YAML content is empty string. ('foo cc: end_cc bar', None), # Return expected dictionary without trailing end_cc marker. From 104796bb2c2c90f160a20ccc720ae0758827b3c9 Mon Sep 17 00:00:00 2001 From: Brett Holman Date: Tue, 7 Dec 2021 12:30:12 -0700 Subject: [PATCH 2/4] fixup --- tests/unittests/test_util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unittests/test_util.py b/tests/unittests/test_util.py index f35ca12001d..20027351b6b 100644 --- a/tests/unittests/test_util.py +++ b/tests/unittests/test_util.py @@ -976,7 +976,7 @@ class TestReadCcFromCmdline: "cmdline,expected_cfg", [ # Return None if cmdline has no cc:end_cc content. - ('cmdline has no cc content', None), + pytest.param(CiTestCase.random_string(), None, id="random_string"), # Return None if YAML content is empty string. ('foo cc: end_cc bar', None), # Return expected dictionary without trailing end_cc marker. From dcbdb41a430fc7c3a57ba5cccada9a400bf91c3b Mon Sep 17 00:00:00 2001 From: Brett Holman Date: Tue, 7 Dec 2021 12:54:52 -0700 Subject: [PATCH 3/4] play nice with old pythons --- tests/unittests/test_util.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/unittests/test_util.py b/tests/unittests/test_util.py index 20027351b6b..3f7677765fb 100644 --- a/tests/unittests/test_util.py +++ b/tests/unittests/test_util.py @@ -972,11 +972,17 @@ def test_is_lxd_false_when_sock_device_absent(self, m_exists): class TestReadCcFromCmdline: + if hasattr(pytest, "param"): + random_string = pytest.param( + CiTestCase.random_string(), None, id="random_string") + else: + random_string = (CiTestCase.random_string(), None), + @pytest.mark.parametrize( "cmdline,expected_cfg", [ # Return None if cmdline has no cc:end_cc content. - pytest.param(CiTestCase.random_string(), None, id="random_string"), + random_string, # Return None if YAML content is empty string. ('foo cc: end_cc bar', None), # Return expected dictionary without trailing end_cc marker. From 5d64fb4b6f9393cf4327867a12526b36bf10a0bf Mon Sep 17 00:00:00 2001 From: Brett Holman Date: Tue, 7 Dec 2021 13:07:29 -0700 Subject: [PATCH 4/4] fixup --- tests/unittests/test_util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unittests/test_util.py b/tests/unittests/test_util.py index 3f7677765fb..93d85f15d05 100644 --- a/tests/unittests/test_util.py +++ b/tests/unittests/test_util.py @@ -976,7 +976,7 @@ class TestReadCcFromCmdline: random_string = pytest.param( CiTestCase.random_string(), None, id="random_string") else: - random_string = (CiTestCase.random_string(), None), + random_string = (CiTestCase.random_string(), None) @pytest.mark.parametrize( "cmdline,expected_cfg",