-
Notifications
You must be signed in to change notification settings - Fork 23
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
tests have s subtle execution order bug #103
Comments
That is super weird. I wonder if its some oddity with the pycharm test runner, any idea how well it isolates tests between runs? Because if it just runs them all alphabetically I can see how running |
That’s definitely what happens, I think it’s because the mgui tests are being found and run in somebody else’s runners
…Sent from my iPhone
On Jul 10, 2018, at 8:16 PM, bob-white ***@***.***> wrote:
That is super weird.
Just did a quick local run and the whole test suite passed. Though I'm just running them manually from sublime, not from pycharm.
I wonder if its some oddity with the pycharm test runner, any idea how well it isolates tests between runs? Because if it just runs them all alphabetically I can see how running test_api first would mess up the mocking in test_nested
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Clears mGui from the currently imported modules. This allows for a completely fresh version of the module to be imported. Helps solve #103 which seems to be an issue where an earlier test has already imported mGui before certain commands could be properly mocked.
Realized I never hit comment before actually pushing a new branch. Not sure if its really the best fix, but I use this method when doing GUI tests in maya, as it provides a functional if hacky |
Does it fix the ‘you can’t reload metaclass hierarchies’ problem? |
Yeah, that's actually why I started using it for testing in Maya. There are some issues if you wipe out the module while a window is open, because it loses a bunch of the weakrefs, but better than restarting Maya. |
yeah, I think we can call reloading with open UI an 'advanced feature' we don't want to support. |
Thinking this over I'm wondering if the right thing to do is to a full-blown conversion to mocks. I did a kind of half-assed mock for some tests but its inconsistently applied, I think we could make the testing situation a lot clearer if we went ahead and did it everywhere |
Yeah you're probably right. Depending how deep we need to go for this, it might be worth checking with some of the other Maya projects, someone might have a base we can build off of. |
This is from something else I'm playing with... but it works, and I think is showcases a way forward:
|
incidentally it looks like maya 2019 (the beta) is breaking all the |
Looking at the tests in my most recent pytcharm install, it appears that the monkeypatching in test_Nested is failing. It used to work, but now when I run the tests I can see that before the patch is applied most of mGui is already loaded. So, replacing
cmds.whatever
in this test has no effect because the loaded modules already have a reference to the proper maya cmds version -- at least, that's what I think is happening.The text was updated successfully, but these errors were encountered: