mirror of
https://github.com/ROCm/jax.git
synced 2025-04-15 19:36:06 +00:00
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:
parent
fdc8864d9b
commit
a8f2d9a186
@ -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",
|
||||
],
|
||||
)
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user