Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid race in tests #100

Closed
wants to merge 1 commit into from
Closed

Avoid race in tests #100

wants to merge 1 commit into from

Conversation

bmwiedemann
Copy link

When building openSUSE's python-xcffib package
without this patch on a 1-core VM on a busy host,
tests failed with

 FAIL: test_python_code.TestXcffibTestGenerator.test_XcffibTest_generator
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/usr/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
     self.test(*self.arg)
   File "/home/abuild/rpmbuild/BUILD/xcffib-0.9.0/test/test_python_code.py", lin
e 154, in test_XcffibTest_generator
     assert os.environ['DISPLAY'] != old_display
 AssertionError

This PR was done while working on reproducible builds for openSUSE.

When building openSUSE's python-xcffib package
without this patch on a 1-core VM on a busy host,
tests failed with

 FAIL: test_python_code.TestXcffibTestGenerator.test_XcffibTest_generator
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/usr/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
     self.test(*self.arg)
   File "/home/abuild/rpmbuild/BUILD/xcffib-0.9.0/test/test_python_code.py", lin
e 154, in test_XcffibTest_generator
     assert os.environ['DISPLAY'] != old_display
 AssertionError
@tych0
Copy link
Owner

tych0 commented Feb 25, 2020

This doesn't really avoid the race, just makes it less likely, I think. What are the values of old_display and os.environ['DISPLAY'] when it dies? (nosetests -v should tell you this)

@bmwiedemann
Copy link
Author

somehow I cannot reproduce the issue anymore.

given the assertion, I'd think,
old_display and os.environ['DISPLAY'] would have had the same values.

@tych0
Copy link
Owner

tych0 commented Mar 11, 2020

Naturally :). I'm curious what they were. I'll go ahead and close this for now, if we can come up with a better fix for the race than a sleep, I'm open to it. Thanks!

@tych0 tych0 closed this Mar 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants