Docs about cx_freeze support and minor adjustments
--HG-- branch : cx_freeze-support
This commit is contained in:
@@ -1,52 +1,56 @@
|
||||
"""
|
||||
Package to support embedding pytest runner into executable files.
|
||||
|
||||
.. note:: Since we are imported into pytest namespace, we use local imports to
|
||||
be as cheap as possible.
|
||||
"""
|
||||
|
||||
def includes():
|
||||
return [
|
||||
'_pytest.assertion.newinterpret',
|
||||
'_pytest.assertion.oldinterpret',
|
||||
'_pytest.assertion.reinterpret',
|
||||
'_pytest.assertion.rewrite',
|
||||
'_pytest.assertion.util',
|
||||
"""
|
||||
Returns a list of module names used by py.test that should be
|
||||
included by cx_freeze.
|
||||
"""
|
||||
import py
|
||||
import _pytest
|
||||
|
||||
'_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',
|
||||
result = list(_iter_all_modules(py))
|
||||
result += list(_iter_all_modules(_pytest))
|
||||
|
||||
'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
|
||||
# builtin files imported by pytest using py.std implicit mechanism;
|
||||
# should be removed if https://bitbucket.org/hpk42/pytest/pull-request/185
|
||||
# gets merged
|
||||
result += [
|
||||
'argparse',
|
||||
'shlex',
|
||||
'warnings',
|
||||
'types',
|
||||
]
|
||||
]
|
||||
return result
|
||||
|
||||
|
||||
def _iter_all_modules(package, prefix=''):
|
||||
"""
|
||||
Iterates over the names of all modules that can be found in the given
|
||||
package, recursively.
|
||||
|
||||
Example:
|
||||
_iter_all_modules(_pytest) ->
|
||||
['_pytest.assertion.newinterpret',
|
||||
'_pytest.capture',
|
||||
'_pytest.core',
|
||||
...
|
||||
]
|
||||
"""
|
||||
import pkgutil
|
||||
import os
|
||||
|
||||
if type(package) is not str:
|
||||
path, prefix = package.__path__[0], package.__name__ + '.'
|
||||
else:
|
||||
path = package
|
||||
for _, name, is_package in pkgutil.iter_modules([path]):
|
||||
if is_package:
|
||||
for m in _iter_all_modules(os.path.join(path, name), prefix=name + '.'):
|
||||
yield prefix + m
|
||||
else:
|
||||
yield prefix + name
|
||||
|
||||
Reference in New Issue
Block a user