From 48101ce79eae3d82e60f84b4c3ee09fea2d20efb Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Thu, 3 Dec 2020 14:04:16 -0500 Subject: [PATCH] Expand test_examples skip on macOS The test skip we had in place on test_examples was for macOS with python 3.8. This was because when we first enabled python 3.8 support, the change to use spawn as the default macOS multiprocessing launch method was causing the tests to fail with the way the examples are written (without using '__name__ == "__main__"'). When we added Python 3.9 support in #5189 these tests were run because skip was only on 3.8. While the tests appear to work most of the time (and passed ci in #5189) as these jobs have been running in CI the test_examples module has occasionally been segfaulting when running the example, which has resulted in a failure rate of roughly 8-10%. This commit expands the macOS skip on the tests to be >= 3.8 so we avoid these failure conditions. --- test/python/test_examples.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/python/test_examples.py b/test/python/test_examples.py index f926e1ef628b..d10caf421d64 100644 --- a/test/python/test_examples.py +++ b/test/python/test_examples.py @@ -30,8 +30,8 @@ class TestPythonExamples(QiskitTestCase): """Test example scripts""" - @unittest.skipIf(sys.platform == 'darwin' and sys.version_info[1] == 8, - "Multiprocess spawn fails on macOS python 3.8 without " + @unittest.skipIf(sys.platform == 'darwin' and sys.version_info[1] >= 8, + "Multiprocess spawn fails on macOS python >=3.8 without " "__name__ == '__main__' guard") def test_all_examples(self): """Execute the example python files and pass if it returns 0.""" @@ -52,8 +52,8 @@ def test_all_examples(self): stdout, stderr) self.assertEqual(run_example.returncode, 0, error_string) - @unittest.skipIf(sys.platform == 'darwin' and sys.version_info[1] == 8, - "Multiprocess spawn fails on macOS python 3.8 without " + @unittest.skipIf(sys.platform == 'darwin' and sys.version_info[1] >= 8, + "Multiprocess spawn fails on macOS python >=3.8 without " "__name__ == '__main__' guard") @online_test @slow_test