Last active
October 1, 2021 22:35
-
-
Save edsu/d673b3c5cbfb666089cc2de238a8b5d0 to your computer and use it in GitHub Desktop.
Who tests the test testers?
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
#!/usr/bin/env python3 | |
import re | |
import sys | |
import pytest | |
import shutil | |
import pathlib | |
name = sys.argv[1] | |
work = pathlib.Path('.') | |
mfile, tfile = [f for f in sorted(work.iterdir()) if re.match(name, f.name)] | |
# convert uploaded filename to the filename that should be imported | |
module_file = re.sub(r'.+_question_\d+_\d+_(.+)$', r'\1', mfile.name) | |
shutil.copyfile(mfile, module_file) | |
print() | |
print(f"module_file: {module_file}") | |
print(f"test file: {tfile.name}") | |
print() | |
pytest.main([tfile.name]) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment