Skip to content

Commit

Permalink
Expand test_examples skip on macOS
Browse files Browse the repository at this point in the history
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 Qiskit#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 Qiskit#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.
  • Loading branch information
mtreinish committed Dec 3, 2020
1 parent b6304ea commit 48101ce
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/python/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand All @@ -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
Expand Down

0 comments on commit 48101ce

Please sign in to comment.