forked from syrusakbary/snapshottest
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unittest session handling, --snapshot-update support
Add test-session-level features for raw unittest framework: * Support --snapshot-update command line option * Issue "SnapshotTest summary" at end of test run * Remove unused snapshots when in update mode This also adds snapshottest-augmented versions of the various ways to run unittest: * `python -m snapshottest ...` parallels `python -m unittest ...` (via module-level `__main__.py`). * `snapshottest.main()` wraps `unittest.main()`. * `SnapshotTestRunnerMixin` can be used with other unittest TestRunner classes. Closes syrusakbary#51
- Loading branch information
Showing
5 changed files
with
184 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
from .snapshot import Snapshot | ||
from .generic_repr import GenericRepr | ||
from .module import assert_match_snapshot | ||
from .unittest import TestCase | ||
from .unittest import TestCase, main | ||
|
||
|
||
__all__ = ["Snapshot", "GenericRepr", "assert_match_snapshot", "TestCase"] | ||
__all__ = ["Snapshot", "GenericRepr", "assert_match_snapshot", "TestCase", "main"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
"""Main entry point (for unittest with snapshottest support)""" | ||
|
||
# This is here to support invoking snapshottest-augmented unittest via | ||
# `python -m snapshottest ...` (paralleling unittest's own `python -m unittest ...`). | ||
# It's copied almost directly from unittest.__main__. | ||
|
||
import sys | ||
|
||
if sys.argv[0].endswith("__main__.py"): | ||
import os.path | ||
|
||
# We change sys.argv[0] to make help message more useful | ||
# use executable without path, unquoted | ||
executable = os.path.basename(sys.executable) | ||
sys.argv[0] = executable + " -m snapshottest" | ||
del os | ||
|
||
from .unittest import main | ||
|
||
main(module=None) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters