-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1773 from nicoddemus/fix-freeze
Use PyInstaller for freeze test env
- Loading branch information
Showing
13 changed files
with
72 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
build/ | ||
dist/ | ||
*.spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
""" | ||
Generates an executable with pytest runner embedded using PyInstaller. | ||
""" | ||
if __name__ == '__main__': | ||
import pytest | ||
import subprocess | ||
|
||
hidden = [] | ||
for x in pytest.freeze_includes(): | ||
hidden.extend(['--hidden-import', x]) | ||
args = ['pyinstaller', '--noconfirm'] + hidden + ['runtests_script.py'] | ||
subprocess.check_call(' '.join(args), shell=True) | ||
|
16 changes: 8 additions & 8 deletions
16
testing/cx_freeze/runtests_script.py → testing/freeze/runtests_script.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
""" | ||
This is the script that is actually frozen into an executable: simply executes | ||
py.test main(). | ||
""" | ||
|
||
if __name__ == '__main__': | ||
import sys | ||
import pytest | ||
""" | ||
This is the script that is actually frozen into an executable: simply executes | ||
py.test main(). | ||
""" | ||
|
||
if __name__ == '__main__': | ||
import sys | ||
import pytest | ||
sys.exit(pytest.main()) |
File renamed without changes.
10 changes: 5 additions & 5 deletions
10
testing/cx_freeze/tests/test_trivial.py → testing/freeze/tests/test_trivial.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
|
||
def test_upper(): | ||
assert 'foo'.upper() == 'FOO' | ||
|
||
def test_lower(): | ||
|
||
def test_upper(): | ||
assert 'foo'.upper() == 'FOO' | ||
|
||
def test_lower(): | ||
assert 'FOO'.lower() == 'foo' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,12 @@ | ||
""" | ||
Called by tox.ini: uses the generated executable to run the tests in ./tests/ | ||
directory. | ||
.. note:: somehow calling "build/runtests_script" directly from tox doesn't | ||
seem to work (at least on Windows). | ||
""" | ||
if __name__ == '__main__': | ||
import os | ||
import sys | ||
|
||
executable = os.path.join(os.getcwd(), 'build', 'runtests_script') | ||
if sys.platform.startswith('win'): | ||
executable += '.exe' | ||
""" | ||
Called by tox.ini: uses the generated executable to run the tests in ./tests/ | ||
directory. | ||
""" | ||
if __name__ == '__main__': | ||
import os | ||
import sys | ||
|
||
executable = os.path.join(os.getcwd(), 'dist', 'runtests_script', 'runtests_script') | ||
if sys.platform.startswith('win'): | ||
executable += '.exe' | ||
sys.exit(os.system('%s tests' % executable)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters