Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
modify test() to run_test() (#460)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
xelmirage authored and fmassa committed Feb 19, 2019
1 parent 5ec0b91 commit f8b0118
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/train_net.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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__":
Expand Down

0 comments on commit f8b0118

Please sign in to comment.