From f8b0118392aae793771cfc6cd869ad0a601d5c92 Mon Sep 17 00:00:00 2001 From: xelmirage Date: Tue, 19 Feb 2019 17:00:48 +0800 Subject: [PATCH] modify test() to run_test() (#460) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I'm using pycharm to debug the code on a remote server, the remote debugging seems to be performed by pytest and it pops errors like: train_net.py E test setup failed file /tmp/pycharm_project_269/tools/train_net.py, line 79 def test(cfg, model, distributed): E fixture 'cfg' not found > available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory > use 'pytest --fixtures [testpath]' for help on them. it seems the function name ‘test()’ has come conflict with pytest, so it may be better use another name. --- tools/train_net.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/train_net.py b/tools/train_net.py index 3f37d55f5..e4f95f015 100644 --- a/tools/train_net.py +++ b/tools/train_net.py @@ -76,7 +76,7 @@ def train(cfg, local_rank, distributed): return model -def test(cfg, model, distributed): +def run_test(cfg, model, distributed): if distributed: model = model.module torch.cuda.empty_cache() # TODO check if it helps @@ -167,7 +167,7 @@ def main(): model = train(cfg, args.local_rank, args.distributed) if not args.skip_test: - test(cfg, model, args.distributed) + run_test(cfg, model, args.distributed) if __name__ == "__main__":