parent
3ba63128da
commit
42b5ee831e
@ -13,5 +13,6 @@ test_script:
|
|||||||
- C:\Python34\Scripts\tox -e smoke
|
- C:\Python34\Scripts\tox -e smoke
|
||||||
- C:\Python34\Scripts\tox -e smoke-frozen
|
- C:\Python34\Scripts\tox -e smoke-frozen
|
||||||
- C:\Python34\Scripts\tox -e unittests
|
- C:\Python34\Scripts\tox -e unittests
|
||||||
|
- C:\Python34\Scripts\tox -e unittests-frozen
|
||||||
- C:\Python34\Scripts\tox -e pyflakes
|
- C:\Python34\Scripts\tox -e pyflakes
|
||||||
- C:\Python34\Scripts\tox -e pylint
|
- C:\Python34\Scripts\tox -e pylint
|
||||||
|
82
scripts/freeze_tests.py
Executable file
82
scripts/freeze_tests.py
Executable file
@ -0,0 +1,82 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
|
||||||
|
|
||||||
|
# Copyright 2015 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
|
||||||
|
#
|
||||||
|
# This file is part of qutebrowser.
|
||||||
|
#
|
||||||
|
# qutebrowser is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# qutebrowser is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
"""cx_Freeze script to freeze qutebrowser and its tests."""
|
||||||
|
|
||||||
|
|
||||||
|
import os
|
||||||
|
import os.path
|
||||||
|
import sys
|
||||||
|
import contextlib
|
||||||
|
|
||||||
|
import cx_Freeze as cx # pylint: disable=import-error
|
||||||
|
# cx_Freeze is hard to install (needs C extensions) so we don't check for it.
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir))
|
||||||
|
from scripts import setupcommon
|
||||||
|
from scripts.freeze import build_exe_options as normal_build_exe_options
|
||||||
|
|
||||||
|
|
||||||
|
@contextlib.contextmanager
|
||||||
|
def temp_git_commit_file():
|
||||||
|
"""Context manager to temporarily create a fake git-commit-id file."""
|
||||||
|
basedir = os.path.join(os.path.dirname(os.path.realpath(__file__)),
|
||||||
|
os.path.pardir)
|
||||||
|
path = os.path.join(basedir, 'qutebrowser', 'git-commit-id')
|
||||||
|
with open(path, 'wb') as f:
|
||||||
|
f.write(b'fake-frozen-git-commit')
|
||||||
|
yield
|
||||||
|
os.remove(path)
|
||||||
|
|
||||||
|
|
||||||
|
def get_build_exe_options():
|
||||||
|
"""Get build_exe options with additional includes."""
|
||||||
|
opts = dict(normal_build_exe_options)
|
||||||
|
# Remove documentation from include_files.
|
||||||
|
skipped_include_files = [
|
||||||
|
os.path.join('qutebrowser', 'html'),
|
||||||
|
os.path.join('qutebrowser', 'html', 'doc')
|
||||||
|
]
|
||||||
|
include_files = [e for e in normal_build_exe_options['include_files']
|
||||||
|
if e[0] not in skipped_include_files]
|
||||||
|
opts['include_files'] = include_files
|
||||||
|
|
||||||
|
opts['includes'] += pytest.freeze_includes() # pylint: disable=no-member
|
||||||
|
opts['includes'] += ['unittest.mock', 'PyQt5.QtTest']
|
||||||
|
|
||||||
|
opts['packages'].append('qutebrowser')
|
||||||
|
|
||||||
|
return opts
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""Main entry point."""
|
||||||
|
with temp_git_commit_file():
|
||||||
|
cx.setup(
|
||||||
|
executables=[cx.Executable('scripts/run_frozen_tests.py',
|
||||||
|
targetName='run-frozen-tests')],
|
||||||
|
options={'build_exe': get_build_exe_options()},
|
||||||
|
**setupcommon.setupdata
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
33
scripts/run_frozen_tests.py
Normal file
33
scripts/run_frozen_tests.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
|
||||||
|
|
||||||
|
# Copyright 2015 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
|
||||||
|
#
|
||||||
|
# This file is part of qutebrowser.
|
||||||
|
#
|
||||||
|
# qutebrowser is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# qutebrowser is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
# pylint: disable=import-error,no-member
|
||||||
|
|
||||||
|
"""cx_Freeze script to run qutebrowser tests on the frozen executable."""
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
import pytestqt.plugin
|
||||||
|
import pytest_mock
|
||||||
|
import pytest_capturelog
|
||||||
|
|
||||||
|
sys.exit(pytest.main(plugins=[pytestqt.plugin, pytest_mock,
|
||||||
|
pytest_capturelog]))
|
12
tox.ini
12
tox.ini
@ -31,6 +31,18 @@ commands =
|
|||||||
{envpython} scripts/link_pyqt.py --tox {envdir}
|
{envpython} scripts/link_pyqt.py --tox {envdir}
|
||||||
{envpython} -m py.test --strict -rfEsw {posargs}
|
{envpython} -m py.test --strict -rfEsw {posargs}
|
||||||
|
|
||||||
|
[testenv:unittests-frozen]
|
||||||
|
setenv = {[testenv:unittests]setenv}
|
||||||
|
passenv = {[testenv:unittests]passenv}
|
||||||
|
skip_install = true
|
||||||
|
deps =
|
||||||
|
{[testenv:unittests]deps}
|
||||||
|
cx_Freeze==4.3.4
|
||||||
|
commands =
|
||||||
|
{envpython} scripts/link_pyqt.py --tox {envdir}
|
||||||
|
{envpython} scripts/freeze_tests.py build_exe -b {envdir}/build
|
||||||
|
{envdir}/build/run-frozen-tests --strict -rfEsw {posargs}
|
||||||
|
|
||||||
[testenv:coverage]
|
[testenv:coverage]
|
||||||
passenv = PYTHON DISPLAY XAUTHORITY HOME
|
passenv = PYTHON DISPLAY XAUTHORITY HOME
|
||||||
deps =
|
deps =
|
||||||
|
Loading…
Reference in New Issue
Block a user