first implementation and tox environment for cx-freeze support
--HG-- branch : cx_freeze-support
This commit is contained in:
parent
bcdc3d0154
commit
990e7bf3b9
|
@ -0,0 +1,52 @@
|
|||
|
||||
|
||||
def includes():
|
||||
return [
|
||||
'_pytest.assertion.newinterpret',
|
||||
'_pytest.assertion.oldinterpret',
|
||||
'_pytest.assertion.reinterpret',
|
||||
'_pytest.assertion.rewrite',
|
||||
'_pytest.assertion.util',
|
||||
|
||||
'_pytest._argcomplete',
|
||||
'_pytest.doctest',
|
||||
'_pytest.pdb',
|
||||
'_pytest.unittest',
|
||||
'_pytest.capture',
|
||||
'_pytest.config',
|
||||
'_pytest.core',
|
||||
'_pytest.genscript',
|
||||
'_pytest.helpconfig',
|
||||
'_pytest.hookspec',
|
||||
'_pytest.junitxml',
|
||||
'_pytest.main',
|
||||
'_pytest.mark',
|
||||
'_pytest.monkeypatch',
|
||||
'_pytest.nose',
|
||||
'_pytest.pastebin',
|
||||
'_pytest.pytester',
|
||||
'_pytest.python',
|
||||
'_pytest.recwarn',
|
||||
'_pytest.resultlog',
|
||||
'_pytest.runner',
|
||||
'_pytest.skipping',
|
||||
'_pytest.standalonetemplate',
|
||||
'_pytest.terminal',
|
||||
'_pytest.tmpdir',
|
||||
|
||||
'py._builtin',
|
||||
'py._path.local',
|
||||
'py._io.capture',
|
||||
'py._io.saferepr',
|
||||
'py._iniconfig',
|
||||
'py._io.terminalwriter',
|
||||
'py._xmlgen',
|
||||
'py._error',
|
||||
'py._std',
|
||||
|
||||
# builtin files imported by pytest using py.std implicit mechanism
|
||||
'argparse',
|
||||
'shlex',
|
||||
'warnings',
|
||||
'types',
|
||||
]
|
|
@ -13,6 +13,7 @@ if __name__ == '__main__': # if run as a script or by 'python -m pytest'
|
|||
|
||||
from _pytest.config import main, UsageError, _preloadplugins, cmdline
|
||||
from _pytest import __version__
|
||||
from _pytest import cx_freeze_support
|
||||
|
||||
_preloadplugins() # to populate pytest.* namespace so help(pytest) works
|
||||
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
import os
|
||||
import sys
|
||||
|
||||
executable = os.path.join(os.getcwd(), 'build', 'runtests_script')
|
||||
if sys.platform.startswith('win'):
|
||||
executable += '.exe'
|
||||
sys.exit(os.system('%s tests' % executable))
|
|
@ -0,0 +1,10 @@
|
|||
"""
|
||||
Simple script that actually executes py.test runner when passed "--pytest" as
|
||||
first argument; in this case, all other arguments are forwarded to pytest's
|
||||
main().
|
||||
"""
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
import pytest
|
||||
sys.exit(pytest.main())
|
|
@ -0,0 +1,11 @@
|
|||
from cx_Freeze import setup, Executable
|
||||
|
||||
import pytest
|
||||
setup(
|
||||
name="runtests",
|
||||
version="0.1",
|
||||
description="exemple of how embedding py.test into an executable using cx_freeze",
|
||||
executables=[Executable("runtests_script.py")],
|
||||
options={"build_exe": {'includes': pytest.cx_freeze_support.includes()}},
|
||||
)
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
|
||||
Testing doctest::
|
||||
|
||||
>>> 1 + 1
|
||||
2
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
def test_upper():
|
||||
assert 'foo'.upper() == 'FOO'
|
||||
|
||||
def test_lower():
|
||||
assert 'FOO'.lower() == 'foo'
|
8
tox.ini
8
tox.ini
|
@ -123,6 +123,14 @@ commands=
|
|||
{envpython} {envbindir}/py.test-jython \
|
||||
-rfsxX --junitxml={envlogdir}/junit-{envname}2.xml []
|
||||
|
||||
[testenv:py27-cxfreeze]
|
||||
deps=cx_freeze
|
||||
changedir=testing/cx_freeze
|
||||
basepython=python2.7
|
||||
commands=
|
||||
{envpython} runtests_setup.py build --build-exe build
|
||||
{envpython} run.py
|
||||
|
||||
[pytest]
|
||||
minversion=2.0
|
||||
plugins=pytester
|
||||
|
|
Loading…
Reference in New Issue