diff --git a/make_coverage.py b/make_coverage.py new file mode 100644 index 0000000000000000000000000000000000000000..3d93f39ebed5a50c877a9ef72ab4b1a4602f2f53 --- /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 6dabe2b633ce8939028fdabcfc7b6245abf21758..7ccbdb736b9b53743b58cfd985538705c5e79f08 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')