[tor-commits] [stem/master] Skipping deletion of pyc in __pycache__

atagar at torproject.org atagar at torproject.org
Sat Feb 2 18:20:50 UTC 2013


commit d9d46cb5b35f586bcf8025cb7682c4ad79e57e15
Author: Damian Johnson <atagar at torproject.org>
Date:   Thu Jan 31 08:31:53 2013 -0800

    Skipping deletion of pyc in __pycache__
    
    I disabled the deletion of orphaned pyc files when testing python 3 but on
    reflection that wasn't enough. Python 2.x test runs still delete the python 3
    bytecode. Changing the orphaned check to skip those files.
---
 run_tests.py |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/run_tests.py b/run_tests.py
index d18ec9d..feab3a7 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -271,22 +271,22 @@ def load_user_configuration(test_config):
 
 
 def _clean_orphaned_pyc():
-  # If we're running python 3 then the *.pyc files are no longer bundled with
-  # the *.py. Rather, they're in a __pycache__ directory.
-  #
-  # At the moment there's no point in checking for orphaned bytecode with
-  # python 3 because it's an exported copy of the python 2 codebase, so
-  # skipping.
-
-  if CONFIG["argument.python3"]:
-    return
-
   test.output.print_noline("  checking for orphaned .pyc files... ", *test.runner.STATUS_ATTR)
 
   orphaned_pyc = []
 
   for base_dir in ('stem', 'test', 'run_tests.py'):
     for pyc_path in test.check_whitespace._get_files_with_suffix(base_dir, ".pyc"):
+      # If we're running python 3 then the *.pyc files are no longer bundled
+      # with the *.py. Rather, they're in a __pycache__ directory.
+      #
+      # At the moment there's no point in checking for orphaned bytecode with
+      # python 3 because it's an exported copy of the python 2 codebase, so
+      # skipping.
+
+      if "__pycache__" in pyc_path:
+        continue
+
       if not os.path.exists(pyc_path[:-1]):
         orphaned_pyc.append(pyc_path)
 





More information about the tor-commits mailing list