Skip to content

Commit 20ab2d7

Browse files
committed
using py.test genscript
1 parent aee36f7 commit 20ab2d7

File tree

4 files changed

+2866
-3
lines changed

4 files changed

+2866
-3
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ install:
55
- "pip install -r requirements.txt --use-mirrors"
66
- "pip install pytest mock --use-mirrors"
77
script:
8-
- "cd test; py.test"
8+
- "python setup.py test"

fabfile.py

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ def build_windows_dist():
1111
def run_tests():
1212
test_dir = "test"
1313
with lcd(test_dir):
14+
# Regenerate the test script
15+
local("py.test --genscript=runtests.py")
1416
t = local("py.test --cov-config .coveragerc --cov=pypdfocr --cov-report=term --cov-report=html", capture=False)
1517

1618
#with open("test/COVERAGE.rst", "w") as f:

setup.py

+18-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,22 @@
44
import pypdfocr
55
import io
66
from pypdfocr.version import __version__
7-
7+
from setuptools import Command
8+
import os
9+
10+
class PyTest(Command):
11+
user_options = []
12+
def initialize_options(self):
13+
pass
14+
def finalize_options(self):
15+
pass
16+
def run(self):
17+
import sys,subprocess
18+
cwd = os.getcwd()
19+
os.chdir('test')
20+
errno = subprocess.call([sys.executable, 'runtests.py'])
21+
os.chdir(cwd)
22+
raise SystemExit(errno)
823

924
def read(*filenames, **kwargs):
1025
encoding = kwargs.get('encoding', 'utf-8')
@@ -42,6 +57,7 @@ def read(*filenames, **kwargs):
4257
},
4358
options = {
4459
"pyinstaller": {"packages": packages}
45-
}
60+
},
61+
cmdclass = {'test':PyTest}
4662

4763
)

0 commit comments

Comments
 (0)