Browse Source

Run flake8 and nose as modules

Running flake8 and nose as modules in run_tests.py make sure that we start
these tools with the same Python as the one executing the script.
micbou 7 years ago
parent
commit
750d3e5ecc
1 changed files with 6 additions and 2 deletions
  1. 6 2
      run_tests.py

+ 6 - 2
run_tests.py

@@ -38,7 +38,9 @@ import argparse
 def RunFlake8():
 def RunFlake8():
   print( 'Running flake8' )
   print( 'Running flake8' )
   subprocess.check_call( [
   subprocess.check_call( [
-    'flake8',
+    sys.executable,
+    # __main__ is required on Python 2.6.
+    '-m', 'flake8.__main__',
     p.join( DIR_OF_THIS_SCRIPT, 'python' )
     p.join( DIR_OF_THIS_SCRIPT, 'python' )
   ] )
   ] )
 
 
@@ -84,7 +86,9 @@ def NoseTests( parsed_args, extra_nosetests_args ):
   else:
   else:
     nosetests_args.append( p.join( DIR_OF_THIS_SCRIPT, 'python' ) )
     nosetests_args.append( p.join( DIR_OF_THIS_SCRIPT, 'python' ) )
 
 
-  subprocess.check_call( [ 'nosetests' ] + nosetests_args )
+  subprocess.check_call( [ sys.executable,
+                           # __main__ is required on Python 2.6.
+                           '-m', 'nose.__main__' ] + nosetests_args )
 
 
 
 
 def Main():
 def Main():