-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add at least one test for migrations/convert_cache_to_dataclass_v2.py
- Loading branch information
Showing
1 changed file
with
27 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env python3 | ||
"""Unit tests for convert_cache_to_dataclass_v2.py.""" | ||
import os | ||
import subprocess | ||
|
||
SCRIPT_PATH = os.path.dirname(os.path.realpath(__file__)) | ||
|
||
|
||
def test_convert_v2_help_arg(): | ||
"""Run convert v2 with --help arg. | ||
As a matter of fact, this is just a dry run to catch import and syntax | ||
errors. In other words to have at least some "test". | ||
""" | ||
migration_script_fpath = os.path.join( | ||
SCRIPT_PATH, "..", "convert_cache_to_dataclass_v2.py" | ||
) | ||
migration_proc = subprocess.Popen( | ||
[migration_script_fpath, "--help"], | ||
stdout=subprocess.PIPE, | ||
stderr=subprocess.PIPE, | ||
cwd=SCRIPT_PATH, | ||
) | ||
out, err = migration_proc.communicate() | ||
assert migration_proc.returncode == 0 | ||
assert "usage: convert_cache_to_dataclass_v2.py" in out.decode("utf-8") | ||
assert err.decode("utf-8") == "" |