[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [stem/master] Removing run_tests.py's '--python3' argument
commit e8ce90be6b3aa0dcf2c7b960561ac185d49db3bb
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Sat Jan 3 18:07:41 2015 -0800
Removing run_tests.py's '--python3' argument
Now that we have a unified codebase running tests with python3 is as simple
as...
% python3 run_tests.py --all
No reason to keep our '--python3' argument, which did a 2to3 conversion.
---
docs/faq.rst | 8 -------
run_tests.py | 59 +++++++++++++++++---------------------------------
test/util.py | 68 ----------------------------------------------------------
3 files changed, 20 insertions(+), 115 deletions(-)
diff --git a/docs/faq.rst b/docs/faq.rst
index 2f5df4a..1c0dd70 100644
--- a/docs/faq.rst
+++ b/docs/faq.rst
@@ -503,14 +503,6 @@ error checking and `pep8 <http://pep8.readthedocs.org/en/latest/>`_ for style
checking. If you have them installed then they automatically take place as part
of all test runs.
-If you have **Python 3** installed then you can test our Python 3 compatibility
-with the following. *Note that need to still initially execute run_tests.py
-with a 2.x version of Python.*
-
-::
-
- ~/stem$ ./run_tests.py --all --python3
-
See ``run_tests.py --help`` for more usage information.
.. _how_do_i_build_the_site:
diff --git a/run_tests.py b/run_tests.py
index 2bf2744..dc846e7 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -48,8 +48,6 @@ from test.util import STEM_BASE, Target, Task
ARGS = {
'run_unit': False,
'run_integ': False,
- 'run_python3': False,
- 'run_python3_clean': False,
'specific_test': None,
'logging_runlevel': None,
'tor_path': 'tor',
@@ -59,12 +57,12 @@ ARGS = {
'print_help': False,
}
-OPT = "auit:l:vh"
-OPT_EXPANDED = ["all", "unit", "integ", "python3", "clean", "targets=", "test=", "log=", "tor=", "verbose", "help"]
+OPT = 'auit:l:vh'
+OPT_EXPANDED = ['all', 'unit', 'integ', 'targets=', 'test=', 'log=', 'tor=', 'verbose', 'help']
-CONFIG = stem.util.conf.config_dict("test", {
- "target.torrc": {},
- "integ.test_directory": "./test/data",
+CONFIG = stem.util.conf.config_dict('test', {
+ 'target.torrc': {},
+ 'integ.test_directory': './test/data',
})
SRC_PATHS = [os.path.join(STEM_BASE, path) for path in (
@@ -158,7 +156,7 @@ def main():
pyflakes_task, pep8_task = None, None
- if not stem.prereq.is_python_3() and not args.specific_test:
+ if not args.specific_test:
if stem.util.test_tools.is_pyflakes_available():
pyflakes_task = PYFLAKES_TASK
@@ -179,18 +177,6 @@ def main():
pep8_task,
)
- if args.run_python3 and sys.version_info[0] != 3:
- test.util.run_tasks(
- "EXPORTING TO PYTHON 3",
- Task("checking requirements", test.util.python3_prereq),
- Task("cleaning prior export", test.util.python3_clean, (not args.run_python3_clean,)),
- Task("exporting python 3 copy", test.util.python3_copy_stem),
- Task("running tests", test.util.python3_run_tests),
- )
-
- println("BUG: python3_run_tests() should have terminated our process", ERROR)
- sys.exit(1)
-
# buffer that we log messages into so they can be printed after a test has finished
logging_buffer = stem.util.log.LogBuffer(args.logging_runlevel)
@@ -296,24 +282,23 @@ def main():
println()
- if not stem.prereq.is_python_3():
- static_check_issues = {}
+ static_check_issues = {}
- if pyflakes_task and pyflakes_task.is_successful:
- for path, issues in pyflakes_task.result.items():
- for issue in issues:
- static_check_issues.setdefault(path, []).append(issue)
- elif not stem.util.test_tools.is_pyflakes_available():
- println("Static error checking requires pyflakes version 0.7.3 or later. Please install it from ...\n http://pypi.python.org/pypi/pyflakes\n", ERROR)
+ if pyflakes_task and pyflakes_task.is_successful:
+ for path, issues in pyflakes_task.result.items():
+ for issue in issues:
+ static_check_issues.setdefault(path, []).append(issue)
+ elif not stem.util.test_tools.is_pyflakes_available():
+ println("Static error checking requires pyflakes version 0.7.3 or later. Please install it from ...\n http://pypi.python.org/pypi/pyflakes\n", ERROR)
- if pep8_task and pep8_task.is_successful:
- for path, issues in pep8_task.result.items():
- for issue in issues:
- static_check_issues.setdefault(path, []).append(issue)
- elif not stem.util.test_tools.is_pep8_available():
- println("Style checks require pep8 version 1.4.2 or later. Please install it from...\n http://pypi.python.org/pypi/pep8\n", ERROR)
+ if pep8_task and pep8_task.is_successful:
+ for path, issues in pep8_task.result.items():
+ for issue in issues:
+ static_check_issues.setdefault(path, []).append(issue)
+ elif not stem.util.test_tools.is_pep8_available():
+ println("Style checks require pep8 version 1.4.2 or later. Please install it from...\n http://pypi.python.org/pypi/pep8\n", ERROR)
- _print_static_issues(static_check_issues)
+ _print_static_issues(static_check_issues)
runtime_label = "(%i seconds)" % (time.time() - start_time)
@@ -354,10 +339,6 @@ def _get_args(argv):
args['run_unit'] = True
elif opt in ("-i", "--integ"):
args['run_integ'] = True
- elif opt == "--python3":
- args['run_python3'] = True
- elif opt == "--clean":
- args['run_python3_clean'] = True
elif opt in ("-t", "--targets"):
run_targets, attribute_targets = [], []
diff --git a/test/util.py b/test/util.py
index 714d949..9ccb364 100644
--- a/test/util.py
+++ b/test/util.py
@@ -12,7 +12,6 @@ Helper functions for our test framework.
get_prereq - provides the tor version required to run the given target
get_torrc_entries - provides the torrc entries for a given target
get_help_message - provides usage information for running our tests
- get_python3_destination - location where a python3 copy of stem is exported to
Sets of :class:`~test.util.Task` instances can be ran with
:func:`~test.util.run_tasks`. Functions that are intended for easy use with
@@ -28,17 +27,10 @@ Tasks are...
|- check_pep8_version - checks our version of pep8
|- clean_orphaned_pyc - removes any *.pyc without a corresponding *.py
+- check_for_unused_tests - checks to see if any tests are missing from our settings
-
- Testing Python 3
- |- python3_prereq - checks that we have python3 and 2to3
- |- python3_clean - deletes our prior python3 export
- |- python3_copy_stem - copies our codebase and converts with 2to3
- +- python3_run_tests - runs python 3 tests
"""
import re
import os
-import shutil
import sys
import stem
@@ -200,17 +192,6 @@ def get_torrc_entries(target):
return torrc_opts
-def get_python3_destination():
- """
- Provides the location where a python 3 copy of stem is exported to for
- testing.
-
- :returns: **str** with the relative path to our python 3 location
- """
-
- return os.path.join(CONFIG['integ.test_directory'], 'python3')
-
-
def check_stem_version():
return stem.__version__
@@ -301,55 +282,6 @@ def check_for_unused_tests(paths):
raise ValueError('Test modules are missing from our test/settings.cfg:\n%s' % '\n'.join(unused_tests))
-def python3_prereq():
- for required_cmd in ('2to3', 'python3'):
- if not stem.util.system.is_available(required_cmd):
- raise ValueError("Unable to test python 3 because %s isn't in your path" % required_cmd)
-
-
-def python3_clean(skip = False):
- location = get_python3_destination()
-
- if not os.path.exists(location):
- return 'skipped'
- elif skip:
- return ["Reusing '%s'. Run again with '--clean' if you want a fresh copy." % location]
- else:
- shutil.rmtree(location, ignore_errors = True)
- return 'done'
-
-
-def python3_copy_stem():
- destination = get_python3_destination()
-
- if os.path.exists(destination):
- return 'skipped'
-
- # skips the python3 destination (to avoid an infinite loop)
- def _ignore(src, names):
- if src == os.path.normpath(destination):
- return names
- else:
- return []
-
- os.makedirs(destination)
- shutil.copytree('stem', os.path.join(destination, 'stem'))
- shutil.copytree('test', os.path.join(destination, 'test'), ignore = _ignore)
- shutil.copy('run_tests.py', os.path.join(destination, 'run_tests.py'))
- stem.util.system.call('2to3 --write --nobackups --no-diffs %s' % get_python3_destination())
-
- return 'done'
-
-
-def python3_run_tests():
- println()
- println()
-
- python3_runner = os.path.join(get_python3_destination(), 'run_tests.py')
- exit_status = os.system('python3 %s %s' % (python3_runner, ' '.join(sys.argv[1:])))
- sys.exit(exit_status)
-
-
def _is_test_data(path):
return os.path.normpath(CONFIG['integ.test_directory']) in path
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits