[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem/master] Clean up after setuptools



commit d1174a83c2dcb7b855d8fc986be3ab8f8d88d68c
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Thu Apr 9 19:09:10 2020 -0700

    Clean up after setuptools
    
    Setuptools 'clean' command doesn't work...
    
      https://github.com/pypa/setuptools/issues/1347
    
    Cleaning up after the turds it creates when we run our tests.
---
 test/integ/installation.py | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/test/integ/installation.py b/test/integ/installation.py
index 60b6a73a..57618cc2 100644
--- a/test/integ/installation.py
+++ b/test/integ/installation.py
@@ -19,9 +19,9 @@ import test
 from stem.util.test_tools import asynchronous
 
 BASE_INSTALL_PATH = '/tmp/stem_test'
-DIST_PATH = os.path.join(test.STEM_BASE, 'dist')
 PYTHON_EXE = sys.executable if sys.executable else 'python'
 INSTALL_MISMATCH_MSG = "Running 'python setup.py sdist' doesn't match our git contents in the following way. The manifest in our setup.py may need to be updated...\n\n"
+SETUPTOOLS_LITTER = ('dist', 'stem.egg-info', 'stem_dry_run.egg-info')  # setuptools cruft its 'clean' command won't clean up
 
 
 def _assert_has_all_files(path):
@@ -117,8 +117,11 @@ class TestInstallation(unittest.TestCase):
       if os.path.exists(BASE_INSTALL_PATH):
         shutil.rmtree(BASE_INSTALL_PATH)
 
-      if os.path.exists(DIST_PATH):
-        shutil.rmtree(DIST_PATH)
+      for directory in SETUPTOOLS_LITTER:
+        path = os.path.join(test.STEM_BASE, directory)
+
+        if os.path.exists(path):
+          shutil.rmtree(path)
 
   @asynchronous
   def test_sdist(dependency_pid):
@@ -148,7 +151,7 @@ class TestInstallation(unittest.TestCase):
 
       # tarball has a prefix 'stem-[verion]' directory so stipping that out
 
-      dist_content = glob.glob('%s/*' % DIST_PATH)
+      dist_content = glob.glob('%s/*' % os.path.join(test.STEM_BASE, 'dist'))
 
       if len(dist_content) != 1:
         raise AssertionError('We should only have a single file in our dist directory, but instead had: %s' % ', '.join(dist_content))
@@ -169,5 +172,8 @@ class TestInstallation(unittest.TestCase):
       if issues:
         raise AssertionError(INSTALL_MISMATCH_MSG + '\n'.join(issues))
     finally:
-      if os.path.exists(DIST_PATH):
-        shutil.rmtree(DIST_PATH)
+      for directory in SETUPTOOLS_LITTER:
+        path = os.path.join(test.STEM_BASE, directory)
+
+        if os.path.exists(path):
+          shutil.rmtree(path)

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits