9799e48991dac848a8e3081e493199630e7e3112,allennlp/commands/test_install.py,,_run_test,#Any#,63
Before Change
def _run_test(args: argparse.Namespace):
initial_working_dir = os.getcwd()
module_parent = _get_module_root().parent
logger.info("Changing directory to %s", module_parent)
os.chdir(module_parent)
test_dir = os.path.join(module_parent, "allennlp")
logger.info("Running tests at %s", test_dir)
if args.k:
pytest_k = ["-k", args.k]
pytest_m = ["-m", "not java"]
if args.run_all:
logger.warning("the argument "-k" overwrites "--run-all".")
elif args.run_all:
pytest_k = []
pytest_m = []
else:
pytest_k = ["-k", "not sniff_test"]
pytest_m = ["-m", "not java"]
exit_code = pytest.main([test_dir, "--color=no"] + pytest_k + pytest_m)
// Change back to original working directory after running tests
os.chdir(initial_working_dir)
sys.exit(exit_code)
After Change
def _run_test(args: argparse.Namespace):
module_parent = _get_module_root().parent
logger.info("Changing directory to %s", module_parent)
with pushd(module_parent):
test_dir = os.path.join(module_parent, "allennlp")
logger.info("Running tests at %s", test_dir)
if args.k:
pytest_k = ["-k", args.k]
pytest_m = ["-m", "not java"]
if args.run_all:
logger.warning("the argument "-k" overwrites "--run-all".")
elif args.run_all:
pytest_k = []
pytest_m = []
else:
pytest_k = ["-k", "not sniff_test"]
pytest_m = ["-m", "not java"]
exit_code = pytest.main([test_dir, "--color=no"] + pytest_k + pytest_m)
sys.exit(exit_code)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 4
Instances
Project Name: allenai/allennlp
Commit Name: 9799e48991dac848a8e3081e493199630e7e3112
Time: 2020-01-28
Author: santi.1410@hotmail.com
File Name: allennlp/commands/test_install.py
Class Name:
Method Name: _run_test
Project Name: allenai/allennlp
Commit Name: 9799e48991dac848a8e3081e493199630e7e3112
Time: 2020-01-28
Author: santi.1410@hotmail.com
File Name: scripts/train_fixtures.py
Class Name:
Method Name:
Project Name: coala/coala-bears
Commit Name: 884b26f7e5c3dc6bd52b963616d7f72a4aecafb7
Time: 2016-03-21
Author: mak95@arcor.de
File Name: bears/vcs/git/GitCommitBear.py
Class Name: GitCommitBear
Method Name: run