File tree Expand file tree Collapse file tree 2 files changed +46
-1
lines changed Expand file tree Collapse file tree 2 files changed +46
-1
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ class UsageError(Exception):
65
65
default_plugins = (
66
66
"mark main terminal runner python pdb unittest capture skipping "
67
67
"tmpdir monkeypatch recwarn pastebin helpconfig nose assertion "
68
- "junitxml resultlog doctest cacheprovider" ).split ()
68
+ "junitxml resultlog doctest cacheprovider freeze_support " ).split ()
69
69
70
70
builtin_plugins = set (default_plugins )
71
71
builtin_plugins .add ("pytester" )
Original file line number Diff line number Diff line change
1
+ """
2
+ Provides a function to report all internal modules for using freezing tools
3
+ pytest
4
+ """
5
+
6
+ def pytest_namespace ():
7
+ return {'freeze_includes' : freeze_includes }
8
+
9
+
10
+ def freeze_includes ():
11
+ """
12
+ Returns a list of module names used by py.test that should be
13
+ included by cx_freeze.
14
+ """
15
+ import py
16
+ import _pytest
17
+ result = list (_iter_all_modules (py ))
18
+ result += list (_iter_all_modules (_pytest ))
19
+ return result
20
+
21
+
22
+ def _iter_all_modules (package , prefix = '' ):
23
+ """
24
+ Iterates over the names of all modules that can be found in the given
25
+ package, recursively.
26
+ Example:
27
+ _iter_all_modules(_pytest) ->
28
+ ['_pytest.assertion.newinterpret',
29
+ '_pytest.capture',
30
+ '_pytest.core',
31
+ ...
32
+ ]
33
+ """
34
+ import os
35
+ import pkgutil
36
+ if type (package ) is not str :
37
+ path , prefix = package .__path__ [0 ], package .__name__ + '.'
38
+ else :
39
+ path = package
40
+ for _ , name , is_package in pkgutil .iter_modules ([path ]):
41
+ if is_package :
42
+ for m in _iter_all_modules (os .path .join (path , name ), prefix = name + '.' ):
43
+ yield prefix + m
44
+ else :
45
+ yield prefix + name
You can’t perform that action at this time.
0 commit comments