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

TST: Fix issues with inconsistent tests #1018

Merged
merged 4 commits into from
Aug 10, 2023

Conversation

jbellister-slac
Copy link
Collaborator

Context

This is an attempt to fix #1012.

For the first half of that issue (test_line_edit.py), this adds retries to the change in focus of the line edit while waiting for qtbot to confirm that the change actually took place. This appears to have made these stable for the tests I already changed in this way, and this doesn't affect what they are actually testing.

For the stylesheet test failues in the issue, the only test that fails in isolation when a custom stylesheet is set is this one:

FAILED pydm/tests/utilities/test_stylesheet.py::test_stylesheet_get_style_data - assert 2 == 1.

The others are fine when run by themselves even with a stylesheet set.

But test_stylesheet_get_style_data makes changes to the PYDM_STYLESHEET environment variable, as well as the locally stored stylesheet, and does not clean up after itself if it fails. Then those left over modifications cause the other tests later in the run to fail too.

So the first fix is just to get that test to pass when a custom stylesheet is set. Then I also added a fixture to make sure it always cleans up after even if it fails, and set both tests in that file to use it since the other one has the same problem too.

Testing

Ran the tests with PYDM_STYLESHEET set to https://github.com/pcdshub/vacuumscreens/blob/master/styleSheet/masterStyleSheet.qss

Copy link
Collaborator

@nstelter-slac nstelter-slac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice! just 1 minor spelling issue.

like the use of 'yield' in 'save_and_restore_pydm_stylesheet', keeps code clean.

pydm/tests/utilities/test_stylesheet.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@YektaY YektaY left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@YektaY YektaY merged commit eb945a8 into slaclab:master Aug 10, 2023
18 checks passed
@jbellister-slac jbellister-slac deleted the update_tests branch August 17, 2023 17:35
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.

Inconsistent unit tests in local install
3 participants