diff options
author | Yilei Yang <yileiyang@google.com> | 2022-03-22 15:19:18 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2022-03-22 15:19:45 -0700 |
commit | f6122a6f743fcc0402a9f7a27ae5d9ccb5e45c4e (patch) | |
tree | d026deb8daab98f63787cc22986026643e59251d | |
parent | a862c00853364d0b6c9fd76326ab89c13af26e90 (diff) | |
download | absl-py-f6122a6f743fcc0402a9f7a27ae5d9ccb5e45c4e.tar.gz |
Remove the use of third party `mock` package and future imports in these tests.
Also remove the mock package in bazel WORKSPACE file.
PiperOrigin-RevId: 436585035
Change-Id: I7f8eafac5f7b10dc8f580db20c7ae60711dfdf12
-rw-r--r-- | WORKSPACE | 17 | ||||
-rw-r--r-- | absl/BUILD | 1 | ||||
-rw-r--r-- | absl/flags/BUILD | 1 | ||||
-rw-r--r-- | absl/flags/tests/flags_numeric_bounds_test.py | 6 | ||||
-rw-r--r-- | absl/logging/BUILD | 1 | ||||
-rw-r--r-- | absl/logging/tests/log_before_import_test.py | 6 | ||||
-rw-r--r-- | absl/tests/command_name_test.py | 6 | ||||
-rw-r--r-- | third_party/mock.BUILD | 13 |
8 files changed, 6 insertions, 45 deletions
@@ -17,22 +17,11 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "six_archive", - urls = [ - "http://mirror.bazel.build/pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz", - "https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz", - ], + build_file = "@//third_party:six.BUILD", sha256 = "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a", strip_prefix = "six-1.10.0", - build_file = "@//third_party:six.BUILD", -) - -http_archive( - name = "mock_archive", urls = [ - "http://mirror.bazel.build/pypi.python.org/packages/a2/52/7edcd94f0afb721a2d559a5b9aae8af4f8f2c79bc63fdbe8a8a6c9b23bbe/mock-1.0.1.tar.gz", - "https://pypi.python.org/packages/a2/52/7edcd94f0afb721a2d559a5b9aae8af4f8f2c79bc63fdbe8a8a6c9b23bbe/mock-1.0.1.tar.gz", + "http://mirror.bazel.build/pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz", + "https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz", ], - sha256 = "b839dd2d9c117c701430c149956918a423a9863b48b09c90e30a6013e7d2f44f", - strip_prefix = "mock-1.0.1", - build_file = "@//third_party:mock.BUILD", ) @@ -76,7 +76,6 @@ py_test( deps = [ ":command_name", "//absl/testing:absltest", - "@mock_archive//:mock", ], ) diff --git a/absl/flags/BUILD b/absl/flags/BUILD index 934bd6b..c180599 100644 --- a/absl/flags/BUILD +++ b/absl/flags/BUILD @@ -256,7 +256,6 @@ py_test( ":_validators", ":flags", "//absl/testing:absltest", - "@mock_archive//:mock", ], ) diff --git a/absl/flags/tests/flags_numeric_bounds_test.py b/absl/flags/tests/flags_numeric_bounds_test.py index 5743258..d3c2a95 100644 --- a/absl/flags/tests/flags_numeric_bounds_test.py +++ b/absl/flags/tests/flags_numeric_bounds_test.py @@ -14,14 +14,10 @@ """Tests for lower/upper bounds validators for numeric flags.""" -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - +from unittest import mock from absl import flags from absl.flags import _validators from absl.testing import absltest -import mock class NumericFlagBoundsTest(absltest.TestCase): diff --git a/absl/logging/BUILD b/absl/logging/BUILD index 90702cc..e666d7a 100644 --- a/absl/logging/BUILD +++ b/absl/logging/BUILD @@ -56,7 +56,6 @@ py_test( deps = [ ":logging", "//absl/testing:absltest", - "@mock_archive//:mock", ], ) diff --git a/absl/logging/tests/log_before_import_test.py b/absl/logging/tests/log_before_import_test.py index d1ba61f..903af16 100644 --- a/absl/logging/tests/log_before_import_test.py +++ b/absl/logging/tests/log_before_import_test.py @@ -14,20 +14,16 @@ """Test of logging behavior before app.run(), aka flag and logging init().""" -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - import contextlib import io import os import re import sys import tempfile +from unittest import mock from absl import logging from absl.testing import absltest -import mock logging.get_verbosity() # Access --verbosity before flag parsing. # Access --logtostderr before flag parsing. diff --git a/absl/tests/command_name_test.py b/absl/tests/command_name_test.py index 61af1bb..2679521 100644 --- a/absl/tests/command_name_test.py +++ b/absl/tests/command_name_test.py @@ -15,18 +15,14 @@ """Tests for absl.command_name.""" -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - import ctypes import errno import os import unittest +from unittest import mock from absl import command_name from absl.testing import absltest -import mock def _get_kernel_process_name(): diff --git a/third_party/mock.BUILD b/third_party/mock.BUILD deleted file mode 100644 index 534ff65..0000000 --- a/third_party/mock.BUILD +++ /dev/null @@ -1,13 +0,0 @@ -# Description: -# mock is a library for testing in Python. - -licenses(["notice"]) # BSD - -exports_files(["LICENSE.txt"]) - -py_library( - name = "mock", - srcs = ["mock.py"], - srcs_version = "PY2AND3", - visibility = ["//visibility:public"], -) |