Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions test/common_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,6 @@ def set_rng_seed(seed):
TEST_WITH_SLOW = os.getenv('PYTORCH_TEST_WITH_SLOW', '0') == '1'


parser = argparse.ArgumentParser(add_help=False)
parser.add_argument('--accept', action='store_true')
args, remaining = parser.parse_known_args()
if not ACCEPT:
ACCEPT = args.accept
for i, arg in enumerate(sys.argv):
if arg == '--accept':
del sys.argv[i]
break


class MapNestedTensorObjectImpl(object):
def __init__(self, tensor_map_fn):
self.tensor_map_fn = tensor_map_fn
Expand Down Expand Up @@ -119,8 +108,9 @@ def _get_expected_file(self, name=None):
if not ACCEPT and not os.path.exists(expected_file):
raise RuntimeError(
f"No expect file exists for {os.path.basename(expected_file)} in {expected_file}; "
"to accept the current output, run:\n"
f"python {__main__.__file__} {munged_id} --accept")
"to accept the current output, re-run the failing test after setting the EXPECTTEST_ACCEPT "
"env variable. For example: EXPECTTEST_ACCEPT=1 pytest test/test_models.py -k alexnet"
)

return expected_file

Expand Down