diff options
Diffstat (limited to 'igor.py')
-rw-r--r-- | igor.py | 13 |
1 files changed, 5 insertions, 8 deletions
@@ -62,11 +62,8 @@ def run_tests_with_coverage(tracer, *nose_args): import nose pth_dir = os.path.dirname(os.path.dirname(nose.__file__)) pth_path = os.path.join(pth_dir, "covcov.pth") - pth_file = open(pth_path, "w") - try: + with open(pth_path, "w") as pth_file: pth_file.write("import coverage; coverage.process_startup()\n") - finally: - pth_file.close() version = "%s%s" % sys.version_info[:2] suffix = "%s_%s_%s" % (version, tracer, socket.gethostname()) @@ -161,17 +158,17 @@ def do_check_eol(): checked.add(fname) line = None - for n, line in enumerate(open(fname, "rb")): + for n, line in enumerate(open(fname, "rb"), start=1): if crlf: if "\r" in line: - print("%s@%d: CR found" % (fname, n+1)) + print("%s@%d: CR found" % (fname, n)) return if trail_white: line = line[:-1] if not crlf: line = line.rstrip('\r') if line.rstrip() != line: - print("%s@%d: trailing whitespace found" % (fname, n+1)) + print("%s@%d: trailing whitespace found" % (fname, n)) return if line is not None and not line.strip(): @@ -216,7 +213,7 @@ def print_banner(label): if '__pypy__' in sys.builtin_module_names: pypy_version = sys.pypy_version_info # pylint: disable=E1101 - version += " (pypy %s)" % ".".join([str(v) for v in pypy_version]) + version += " (pypy %s)" % ".".join(str(v) for v in pypy_version) print('=== %s %s %s (%s) ===' % (impl, version, label, sys.executable)) |