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

Snapshots don't update when running nosetests with a class name #153

Open
brettdh opened this issue Jan 13, 2021 · 1 comment
Open

Snapshots don't update when running nosetests with a class name #153

brettdh opened this issue Jan 13, 2021 · 1 comment

Comments

@brettdh
Copy link

brettdh commented Jan 13, 2021

When running nosetests with a test class name, snapshots are not updated
when --snapshot-update is provided on the command line:

# this works
$ nosetests --snapshot-update path/to/test_file.py

# this doesn't
$ nosetests --snapshot-update path/to/test_file.py:TestClass

Minimal repro project here: https://github.com/brettdh/demo-snapshottest-update-bug

@brettdh
Copy link
Author

brettdh commented Jan 13, 2021

From my investigation, the problem appears to be that wantClass is not called if only a class is specified on the nosetests command line. This seems a bit odd, but perhaps it's because the user's command overrides what the plugins say.

For my use case, it might be sufficient to also override wantMethod and look up the class from the method, and set the snapshot_should_update class variable there - but perhaps the snapshot_should_update flag should be set and looked up in a more global context than individual test classes? Even if I take the wantMethod approach, I expect wantMethod won't be called if I specify a specific method on the command line.

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

No branches or pull requests

1 participant