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

Fix tox tests so they will actually fail #524

Merged
merged 1 commit into from
Jul 8, 2022

Conversation

AdamWill
Copy link
Contributor

@AdamWill AdamWill commented Jul 8, 2022

As things stand, the tests never fail when run via tox.
__main__.py runs each individual test script, but always exits
0, even if a test script exits >0.

Signed-off-by: Adam Williamson awilliam@redhat.com

@AdamWill AdamWill mentioned this pull request Jul 8, 2022
@AdamWill
Copy link
Contributor Author

AdamWill commented Jul 8, 2022

It kinda looks like at some point, it was the job of the little bash script in tox.ini to loop over each individual test and handle failures, then someone did half a job of moving that to __main__.py but didn't include the bit that handles failures, and left the bash loop in tox.ini even though it's now entirely pointless.

@AdamWill AdamWill changed the title Fix tests so they will actually fail Fix tox tests so they will actually fail Jul 8, 2022
@AdamWill
Copy link
Contributor Author

AdamWill commented Jul 8, 2022

Updated to clarify this applies to how tox runs the tests. Now I see that they're run differently in CI. (That seems suboptimal; I set up my projects so that CI runs tox, that way you can run the tests locally exactly the way CI runs them...)

@mmckerns
Copy link
Member

mmckerns commented Jul 8, 2022

@AdamWill: dill is an old project and some infrastructure is a decade old. I just recently made sure that dill complies with modern PEP build requirements and usage/install patterns... and am in the process of updating all the "old" hacks that were build when there wasn't support for what was needed. Running the tests (in CI, with main, and with tox) is definitely one of those places that needs a little updating.

@AdamWill
Copy link
Contributor Author

AdamWill commented Jul 8, 2022

Yeah, I know it's a lot of work. Ironically, this is step six in a yak shave that started out with me cleaning up the infrastructure in one of my projects...:D

Copy link
Member

@mmckerns mmckerns left a comment

Choose a reason for hiding this comment

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

You prefer the test results are all displayed at the end (i.e. flush=False)? Arguably it's a bit cleaner when there's other output -- however, other output really should not be there...

@mmckerns mmckerns added the bugfix label Jul 8, 2022
@mmckerns mmckerns added this to the dill-0.3.6 milestone Jul 8, 2022
@AdamWill
Copy link
Contributor Author

AdamWill commented Jul 8, 2022

That wasn't intentional, honestly, I think I was basing off an older version of the existing file (I was jumping around between main and 0.3.5.1 a lot for packaging reasons).

I do think it's maybe better, though. Two of the tests can produce output, I believe - test_selected and test_session.

@mmckerns
Copy link
Member

mmckerns commented Jul 8, 2022

I think the more appropriate thing is to leave it with flush=True... and then let a later PR clean up the spurious output. So, if you can change the value of flush, that'd be great, and I'll merge it.

As things stand, the tests never fail when run via tox.
`__main__.py` runs each individual test script, but always exits
0, even if a test script exits >0.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
@AdamWill
Copy link
Contributor Author

AdamWill commented Jul 8, 2022

Done. For the record, it was actually changed to use flush=True in 260b372 , but without any explanation in the commit message as to why. It may just have been something Leonardo did locally while he was working on the test fix and inadvertently left in the commit?

@mmckerns
Copy link
Member

mmckerns commented Jul 8, 2022

Thanks! It was due to be added after we dropped support for 2.7, but it didn't have it's own PR.

@mmckerns mmckerns merged commit 80ad351 into uqfoundation:master Jul 8, 2022
@leogama
Copy link
Contributor

leogama commented Jul 8, 2022

@AdamWill, I really didn't make any comment on this change as it was very minor. The print(.) statement in tests is a minimalist progress indicator. However, without the flush option the dots accumulate in the buffer and are printed out just at the end, making the tests seem like they are hanging (at least on my cheap notebook).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants