From a8f2d9a1865f90cde6fba60b846edea7791d2223 Mon Sep 17 00:00:00 2001 From: David Pizzuto Date: Fri, 17 Feb 2023 10:55:04 -0800 Subject: [PATCH] deprecation_module: Move to new internal_test_util directory. Now we no longer need to mess with sys.path in deprecation_test. --- .../_src/internal_test_util/deprecation_module.py | 0 tests/BUILD | 2 +- tests/deprecation_test.py | 13 +------------ 3 files changed, 2 insertions(+), 13 deletions(-) rename tests/deprecation_module/__init__.py => jax/_src/internal_test_util/deprecation_module.py (100%) diff --git a/tests/deprecation_module/__init__.py b/jax/_src/internal_test_util/deprecation_module.py similarity index 100% rename from tests/deprecation_module/__init__.py rename to jax/_src/internal_test_util/deprecation_module.py diff --git a/tests/BUILD b/tests/BUILD index 91f0cdec8..9657f4052 100644 --- a/tests/BUILD +++ b/tests/BUILD @@ -473,10 +473,10 @@ py_test( py_test( name = "deprecation_test", srcs = [ - "deprecation_module/__init__.py", "deprecation_test.py", ], deps = [ + "//jax:internal_test_util", "//jax:test_util", ], ) diff --git a/tests/deprecation_test.py b/tests/deprecation_test.py index 7f1ec3a48..d4a5a3a3e 100644 --- a/tests/deprecation_test.py +++ b/tests/deprecation_test.py @@ -12,26 +12,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os -import sys import warnings from absl.testing import absltest from jax._src import test_util as jtu - +from jax._src.internal_test_util import deprecation_module as m class DeprecationTest(absltest.TestCase): def testDeprecation(self): - # This manipulation of sys.path exists to make this test work in Google's - # Hermetic Python environment: it ensures the module is resolvable. - saved_path = sys.path[0] - try: - sys.path[0] = os.path.dirname(__file__) - import deprecation_module as m - finally: - sys.path[0] = saved_path - with warnings.catch_warnings(): warnings.simplefilter("error") self.assertEqual(m.x, 42)