From 92575205a24462c975ee7c18357f64b7578e6b3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Ljungstr=C3=B6m?= <ml@mljx.io> Date: Tue, 9 Apr 2019 17:33:31 +0200 Subject: [PATCH] added make_coverage.py for use on win10, remove python2 compliant code --- make_coverage.py | 15 +++++++++++++++ make_docs.py | 9 +++------ 2 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 make_coverage.py diff --git a/make_coverage.py b/make_coverage.py new file mode 100644 index 0000000..3d93f39 --- /dev/null +++ b/make_coverage.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python + +import os +import webbrowser +import subprocess +from urllib.request import pathname2url + +def browser(pathname): + webbrowser.open("file:" + pathname2url(os.path.abspath(pathname))) + +subprocess.call(['coverage', 'run', '--source', 'flatland', '-m', 'pytest']) +subprocess.call(['coverage', 'report', '-m']) +subprocess.call(['coverage', 'html']) + +browser('htmlcov/index.html') diff --git a/make_docs.py b/make_docs.py index 6dabe2b..7ccbdb7 100644 --- a/make_docs.py +++ b/make_docs.py @@ -3,13 +3,10 @@ import os import webbrowser import subprocess +from urllib.request import pathname2url def browser(pathname): - try: - from urllib import pathname2url - except: - from urllib.request import pathname2url - webbrowser.open("file:" + pathname2url(pathname)) + webbrowser.open("file:" + pathname2url(os.path.abspath(pathname))) def remove_exists(filename): try: @@ -29,4 +26,4 @@ os.chdir('docs') subprocess.call(['python', '-msphinx', '-M', 'clean', '.', '_build']) subprocess.call(['python', '-msphinx', '-M', 'html', '.', '_build']) -browser(os.path.abspath('_build/html/index.html')) +browser('_build/html/index.html') -- GitLab