deprecation_module: Move to new internal_test_util directory.

Now we no longer need to mess with sys.path in deprecation_test.
This commit is contained in:
David Pizzuto 2023-02-17 10:55:04 -08:00
parent fdc8864d9b
commit a8f2d9a186
3 changed files with 2 additions and 13 deletions

View File

@ -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",
],
)

View File

@ -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)