From 03f53e7e8f8f0ca6f2a2c2dd7b6872fb6061abc6 Mon Sep 17 00:00:00 2001 From: Chaitanya Prakash Bapat Date: Tue, 28 Apr 2020 20:23:57 -0700 Subject: [PATCH] Fix nightly large_vector test caused by incorrect with_seed path (#18178) --- tests/nightly/test_large_array.py | 3 +-- tests/nightly/test_large_vector.py | 3 +-- tests/python/unittest/common.py | 36 ------------------------------ 3 files changed, 2 insertions(+), 40 deletions(-) diff --git a/tests/nightly/test_large_array.py b/tests/nightly/test_large_array.py index e26d73c327cc..d93d1835a1ec 100644 --- a/tests/nightly/test_large_array.py +++ b/tests/nightly/test_large_array.py @@ -27,9 +27,8 @@ from mxnet.test_utils import rand_ndarray, assert_almost_equal, rand_coord_2d, default_context, check_symbolic_forward, create_2d_tensor, get_identity_mat, get_identity_mat_batch from mxnet import gluon, nd -from common import with_seed, with_post_test_cleanup, assertRaises +from common import with_seed, assertRaises from mxnet.base import MXNetError -from nose.tools import with_setup import unittest # dimension constants diff --git a/tests/nightly/test_large_vector.py b/tests/nightly/test_large_vector.py index d4365391cf4e..4c81ddd7af79 100644 --- a/tests/nightly/test_large_vector.py +++ b/tests/nightly/test_large_vector.py @@ -27,9 +27,8 @@ from mxnet.test_utils import rand_ndarray, assert_almost_equal, rand_coord_2d, create_vector from mxnet import gluon, nd -from tests.python.unittest.common import with_seed, assertRaises +from common import with_seed, assertRaises from mxnet.base import MXNetError -from nose.tools import with_setup import unittest # dimension constants diff --git a/tests/python/unittest/common.py b/tests/python/unittest/common.py index cbddf0a327e6..9cbbff84a587 100644 --- a/tests/python/unittest/common.py +++ b/tests/python/unittest/common.py @@ -314,42 +314,6 @@ def teardown(): """ mx.nd.waitall() - -def with_post_test_cleanup(): - """ - Helper function that cleans up memory by releasing it from memory pool - Required especially by large tensor tests that have memory footprints in GBs. - """ - def test_helper(orig_test): - @make_decorator(orig_test) - def test_new(*args, **kwargs): - logger = default_logger() - try: - orig_test(*args, **kwargs) - except: - logger.info(test_msg) - raise - finally: - mx.nd.waitall() - mx.cpu().empty_cache() - - -def with_environment(*args_): - """ - Helper function that takes a dictionary of environment variables and their - desired settings and changes the environment in advance of running the - decorated code. The original environment state is reinstated afterwards, - even if exceptions are raised. - """ - def test_helper(orig_test): - @functools.wraps(orig_test) - def test_new(*args, **kwargs): - with environment(*args_): - orig_test(*args, **kwargs) - return test_new - return test_helper - - def run_in_spawned_process(func, env, *args): """ Helper function to run a test in its own process.