summaryrefslogtreecommitdiff
path: root/setuptools/tests
diff options
context:
space:
mode:
authorStephen Finucane <stephen@that.guru>2018-07-13 15:59:55 +0100
committerPaul Ganssle <paul@ganssle.io>2018-08-19 17:12:49 -0400
commit47874756915a9a757f81d87f32ef5bfa2a333a26 (patch)
tree3620db212d191f59530ea2fed67a54b4577db528 /setuptools/tests
parentcf50418d36c80b35e0f791a96f0a828705ebf25f (diff)
downloadpython-setuptools-git-47874756915a9a757f81d87f32ef5bfa2a333a26.tar.gz
egg_info: Touch 'egg-info' directory
'tox' determines whether a package should be rebuilt by comparing the timestamp of the package's 'egg-info' directory and its 'setup.py' or 'setup.cfg' files [1][2]. Unfortunately this checks the 'egg-info' directory itself, which is not updated, unlike the contents of that directory. This means that 'tox' will always rebuild the package once one of the two setup files has been updated. While this is clearly a bug in 'tox' that should be fixed separately, there is merit in using this as a heuristic so enable it. [1] https://github.com/tox-dev/tox/blob/3.1.0/src/tox/venv.py#L253-L257 [2] https://github.com/tox-dev/tox/blob/3.1.0/src/tox/venv.py#L221-L244 Signed-off-by: Stephen Finucane <stephen@that.guru>
Diffstat (limited to 'setuptools/tests')
-rw-r--r--setuptools/tests/test_egg_info.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py
index 1a100266..c7a08295 100644
--- a/setuptools/tests/test_egg_info.py
+++ b/setuptools/tests/test_egg_info.py
@@ -1,9 +1,11 @@
+import datetime
import sys
import ast
import os
import glob
import re
import stat
+import time
from setuptools.command.egg_info import egg_info, manifest_maker
from setuptools.dist import Distribution
@@ -146,6 +148,21 @@ class TestEggInfo:
]
assert sorted(actual) == expected
+ def test_rebuilt(self, tmpdir_cwd, env):
+ """Ensure timestamps are updated when the command is re-run."""
+ self._create_project()
+
+ self._run_egg_info_command(tmpdir_cwd, env)
+ timestamp_a = os.path.getmtime('foo.egg-info')
+
+ # arbitrary sleep just to handle *really* fast systems
+ time.sleep(.001)
+
+ self._run_egg_info_command(tmpdir_cwd, env)
+ timestamp_b = os.path.getmtime('foo.egg-info')
+
+ assert timestamp_a != timestamp_b
+
def test_manifest_template_is_read(self, tmpdir_cwd, env):
self._create_project()
build_files({