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

[tor-commits] [stem/master] Using absolute paths for whitespace checks



commit d46292f0dce4a189457b02a1ea951e845094c509
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Wed Oct 31 08:40:21 2012 -0700

    Using absolute paths for whitespace checks
    
    We were using relative paths for our whitespace checks, which caused varying
    behavior based on our cwd...
    
    atagar@morrigan:~/Desktop/stem$ ./run_tests.py --unit
    ...
    TESTING PASSED (7 seconds)
    
    atagar@morrigan:~/Desktop/stem$ cd ..
    atagar@morrigan:~/Desktop$ stem/run_tests.py --unit
    ...
    WHITESPACE ISSUES
    * stem/example.py
      line 18   - indentation should match surrounding content (2 spaces)
      line 19   - missing 'with' import (from __future__ import with_statement)
      line 23   - indentation should match surrounding content (2 or 8 spaces)
      line 35   - indentation should match surrounding content (4 spaces)
      line 72   - line has trailing whitespace
      line 76   - indentation should match surrounding content (0 spaces)
      line 77   - indentation should match surrounding content (0 spaces)
    
    * stem/run_tests.py
      line 289  - indentation should match surrounding content (2 spaces)
      line 486  - line has trailing whitespace
    
    TESTING PASSED (19 seconds)
    
    Note that 'example.py' isn't part of stem. It's an untracked file that I have
    in the stem directory. The reason that it's being included in the whitespace
    check is that we're grabbing all python files under 'stem' which, now that
    we're one level up, is the whole project.
    
    Using absolute paths that are relative of run_tests.py so we get consistent
    results.
---
 run_tests.py |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/run_tests.py b/run_tests.py
index 266ed0e..2e35beb 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -455,9 +455,10 @@ if __name__ == '__main__':
     
     # TODO: note unused config options afterward?
   
-  whitespace_issues = test.check_whitespace.get_issues("stem")
-  whitespace_issues.update(test.check_whitespace.get_issues("test"))
-  whitespace_issues.update(test.check_whitespace.get_issues("run_tests.py"))
+  base_path = os.path.sep.join(__file__.split(os.path.sep)[:-1])
+  whitespace_issues = test.check_whitespace.get_issues(os.path.join(base_path, "stem"))
+  whitespace_issues.update(test.check_whitespace.get_issues(os.path.join(base_path, "test")))
+  whitespace_issues.update(test.check_whitespace.get_issues(os.path.join(base_path, "run_tests.py")))
   
   if whitespace_issues:
     test.output.print_line("WHITESPACE ISSUES", term.Color.BLUE, term.Attr.BOLD)



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