Skip to content

Commit

Permalink
Fix nightly large_vector test caused by incorrect with_seed path (apa…
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaiBapchya committed Sep 20, 2020
1 parent 3f37582 commit 03f53e7
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 40 deletions.
3 changes: 1 addition & 2 deletions tests/nightly/test_large_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions tests/nightly/test_large_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
36 changes: 0 additions & 36 deletions tests/python/unittest/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 03f53e7

Please sign in to comment.