mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-28 02:04:36 +03:00
Update with pytest
This commit is contained in:
parent
20d00c5fe9
commit
6a83675fe7
|
@ -1,8 +1,8 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
import nose
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import glob
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
# monkey with the path, removing the local directory but adding the Tests/
|
# monkey with the path, removing the local directory but adding the Tests/
|
||||||
# directory for helper.py and the other local imports there.
|
# directory for helper.py and the other local imports there.
|
||||||
|
@ -13,23 +13,20 @@ sys.path.insert(0, os.path.abspath('./Tests'))
|
||||||
# if there's no test selected (mostly) choose a working default.
|
# if there's no test selected (mostly) choose a working default.
|
||||||
# Something is required, because if we import the tests from the local
|
# Something is required, because if we import the tests from the local
|
||||||
# directory, once again, we've got the non-installed PIL in the way
|
# directory, once again, we've got the non-installed PIL in the way
|
||||||
for arg in sys.argv[1:]:
|
for i, arg in enumerate(sys.argv[1:]):
|
||||||
if '.py' in arg:
|
print(i, arg)
|
||||||
|
if arg.startswith('Tests/test_') and arg.endswith('.py'):
|
||||||
|
print("bingo")
|
||||||
|
sys.argv.insert(i+1, '-k')
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
sys.argv.extend(glob.glob('Tests/test*.py'))
|
sys.argv.append('Tests')
|
||||||
|
|
||||||
# Make sure that nose doesn't muck with our paths.
|
# for arg in sys.argv:
|
||||||
if ('--no-path-adjustment' not in sys.argv) and ('-P' not in sys.argv):
|
# if '-n' in arg or '--numprocesses' in arg:
|
||||||
sys.argv.insert(1, '--no-path-adjustment')
|
# break
|
||||||
|
# else: # for
|
||||||
if 'NOSE_PROCESSES' not in os.environ:
|
# sys.argv.extend(['--numprocesses' ,'auto']) # auto-detect number of CPUs
|
||||||
for arg in sys.argv:
|
|
||||||
if '--processes' in arg:
|
|
||||||
break
|
|
||||||
else: # for
|
|
||||||
sys.argv.insert(1, '--processes=-1') # -1 == number of cores
|
|
||||||
sys.argv.insert(1, '--process-timeout=30')
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
nose.main()
|
pytest.main()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user