aboutsummaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorRichard Levasseur <rlevasseur@google.com>2018-10-04 09:37:49 -0700
committerCopybara-Service <copybara-piper@google.com>2018-10-04 09:38:05 -0700
commit9f0362f2b0ebaaf144f5c8330b28d810ef222ac4 (patch)
tree95773533c758e6db1e7ee9a150d5d499e63536a5 /setup.py
parent2142c8c3fac2ad259248fa3416be7bc05b913b01 (diff)
downloadabsl-py-9f0362f2b0ebaaf144f5c8330b28d810ef222ac4.tar.gz
Tempfile management APIs for absltest.TestCase
This adds two methods to absltest.TestCase: create_tempfile() and create_tempdir(), which allow easy and correct creation of tempfiles and tempdirs in tests. Creating tempfiles in tests has a variety of subtleties that these methods take care of. Notable subtlties are platform compatibility, passing FLAGS.test_tmpdir around correctly, passing the right arguments to mkstemp, mkdtemp, and NamedTemporaryFile, cleanup of files, Python 2/3 API differences in file/path functions, and ensuring file isolation between tests, among other difficulties. To aid debugging, cleanup of files/dirs can be controlled by the class/instance level, by setting tempfile_cleanup, or at the `create_temp{file,dir}()` call level by passing the `cleanup` arg. The net effect is that tempfile setup/teardown is reduced from ~20 lines to ~3 lines, and the previously mentioned problems are taken care of by the test framework. New Dependencies: * enum34: Required under Python 2.7. Under Bazel, it is always required, but is not used under Python 3. Other changes: * Some unrelated lines had type annotations added; this was necessary to make pytype happy. PiperOrigin-RevId: 215751711
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/setup.py b/setup.py
index be45325..7d43ec8 100644
--- a/setup.py
+++ b/setup.py
@@ -52,6 +52,7 @@ setuptools.setup(
]),
install_requires=[
'six',
+ "enum34; python_version<='3.4'"
],
license='Apache 2.0',
classifiers=[