Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support secondary arguments support to load_ui #81

Closed
wants to merge 65 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
d286429
Add tests for improvements in load_ui
fredrikaverpil Jul 28, 2016
b9a5d96
Add distinguishable test descriptions
fredrikaverpil Jul 28, 2016
1b068a1
Add support for additional load_ui arguments
fredrikaverpil Jul 28, 2016
dfa8587
Specify a non-binary mode
fredrikaverpil Jul 28, 2016
174833e
Update with load_ui additional arguments info
fredrikaverpil Jul 28, 2016
c61b33d
Remove QMenuBar and QStatusBar from UI
fredrikaverpil Jul 28, 2016
73920a9
Revert "Remove QMenuBar and QStatusBar from UI"
fredrikaverpil Jul 28, 2016
c6dc043
Simplify tests
mottosso Jul 29, 2016
ce6fb63
Merge pull request #2 from abstractfactory/feature/load_ui
fredrikaverpil Jul 29, 2016
cae6aff
Remove whitespace
fredrikaverpil Jul 29, 2016
6dad71f
Add Xvfb
fredrikaverpil Jul 31, 2016
a01dee1
Add xvfbwrapper
fredrikaverpil Jul 31, 2016
9636bf2
Add xvfbwrapper to .travis.yml
fredrikaverpil Jul 31, 2016
cf6b7d7
Add tests title consistency
fredrikaverpil Jul 31, 2016
0efaa10
Revert "Add xvfbwrapper to .travis.yml"
fredrikaverpil Jul 31, 2016
1075d02
Remove xvfbwrapper
fredrikaverpil Jul 31, 2016
211db11
Add tests for improvements in load_ui
fredrikaverpil Jul 28, 2016
e07eaab
Add distinguishable test descriptions
fredrikaverpil Jul 28, 2016
1ef25b4
Add support for additional load_ui arguments
fredrikaverpil Jul 28, 2016
57b7956
Specify a non-binary mode
fredrikaverpil Jul 28, 2016
a440883
Update with load_ui additional arguments info
fredrikaverpil Jul 28, 2016
231819d
Remove QMenuBar and QStatusBar from UI
fredrikaverpil Jul 28, 2016
b443923
Revert "Remove QMenuBar and QStatusBar from UI"
fredrikaverpil Jul 28, 2016
41dbb76
Simplify tests
mottosso Jul 29, 2016
9f25323
Remove whitespace
fredrikaverpil Jul 29, 2016
9c4f7d7
Add Xvfb
fredrikaverpil Jul 31, 2016
189c0ed
Add xvfbwrapper
fredrikaverpil Jul 31, 2016
9fb8646
Add xvfbwrapper to .travis.yml
fredrikaverpil Jul 31, 2016
bfd9cae
Add tests title consistency
fredrikaverpil Jul 31, 2016
adf4c2b
Revert "Add xvfbwrapper to .travis.yml"
fredrikaverpil Jul 31, 2016
0f4ee5a
Remove xvfbwrapper
fredrikaverpil Jul 31, 2016
f24fc29
Merged branch feature/load_ui into feature/load_ui
fredrikaverpil Aug 1, 2016
69bb70f
Change UI template into QWidget
fredrikaverpil Aug 1, 2016
fe4889c
Squelch xvfb messages
mottosso Aug 1, 2016
cd656b7
- Remove duplicate definition from prior merge
mottosso Aug 1, 2016
84bfc84
Merge pull request #3 from abstractfactory/feature/load_ui
fredrikaverpil Aug 1, 2016
b17413e
Add docstring fixes
fredrikaverpil Aug 1, 2016
1d363a6
Avoid defining UiLoader class twice
fredrikaverpil Aug 1, 2016
cb6d835
Avoid doctest of pyside_load_ui
fredrikaverpil Aug 1, 2016
ee30a6d
Fix docstrings for load_ui: PyQt4/PyQt5
fredrikaverpil Aug 1, 2016
c231100
Add consistency on load_ui wrap functions
fredrikaverpil Aug 1, 2016
b4ed328
- Alternative UiLoader implementation
mottosso Aug 1, 2016
7703fda
Merge pull request #4 from abstractfactory/feature/load_ui
fredrikaverpil Aug 1, 2016
2de9542
Revert change UI template into QWidget
fredrikaverpil Aug 2, 2016
58b7e4e
Add comments
fredrikaverpil Aug 2, 2016
02bc2ea
Merge tag '0.3.3'
fredrikaverpil Aug 4, 2016
049213a
Add tests for widget parent and class
fredrikaverpil Aug 4, 2016
8929b63
Add test for missing/invalid widget class
fredrikaverpil Aug 4, 2016
ecf2780
Merge remote-tracking branch 'refs/remotes/mottosso/master'
fredrikaverpil Aug 8, 2016
4cf7294
Remove class
fredrikaverpil Aug 8, 2016
7dd4d6c
Comment out test with invalid class
fredrikaverpil Aug 8, 2016
99b1e99
Add custom widgets support and tests
fredrikaverpil Aug 8, 2016
0ea392a
Add consistency
fredrikaverpil Aug 8, 2016
87c7dae
Add more tests for custom widgets
fredrikaverpil Aug 8, 2016
7bfb97e
Remove whitespace and fix linting issues
fredrikaverpil Aug 8, 2016
3daabe9
Retry appveyor PyQt4 download
fredrikaverpil Aug 8, 2016
55f464f
Remove custom widgets support
fredrikaverpil Aug 9, 2016
f9abc92
Remove extension of UiLoader
fredrikaverpil Aug 11, 2016
a545edd
Add tests for QWidget, QDialog
fredrikaverpil Aug 11, 2016
61bcb86
Add tests for signals
fredrikaverpil Aug 12, 2016
5e5825b
Remove untestable test
fredrikaverpil Aug 12, 2016
a44a466
Add better test descriptions
fredrikaverpil Aug 12, 2016
cfe625c
Add complete usage examples
fredrikaverpil Aug 12, 2016
7c18457
Skip attributes with double leading underscore
fredrikaverpil Aug 12, 2016
b3a3cf4
Amend README, add example with second argument
fredrikaverpil Aug 12, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,16 @@ RUN apt-get update && apt-get install -y \
xvfb

# Nose is the Python test-runner
RUN pip install nose nosepipe
RUN pip install nose nosepipe xvfbwrapper
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

About this, have a look at xvfb-run. It does the same thing, but without infecting our tests. This might limit tests from running on anything but Linux, and adds that additional indentation to a lot of lines.

$ xvfb-run docker run ...


# Enable additional output from Qt.py
ENV QT_VERBOSE true

# Xvfb
ENV DISPLAY :99

WORKDIR /workspace/Qt.py
ENTRYPOINT cp -r /Qt.py /workspace && \
python build_caveats_tests.py && \
Xvfb :99 -screen 0 1024x768x16 & \
sleep 3 && \
nosetests \
--verbose \
--with-process-isolation \
--with-doctest \
--exe
--exe
90 changes: 53 additions & 37 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ def pyside():
os.environ.pop("QT_PREFERRED_BINDING")


@contextlib.contextmanager
def xvfb():
from xvfbwrapper import Xvfb

vdisplay = Xvfb()
vdisplay.start()

yield

# vdisplay.stop()


@contextlib.contextmanager
def ui():
source = """\
Expand Down Expand Up @@ -219,67 +231,71 @@ def test_vendoring():
def test_load_ui_into_self_pyside():
"""load_ui: Load widgets into self using PySide"""

with ui() as fname:
with pyside():
from Qt import QtWidgets, load_ui
with xvfb():
with ui() as fname:
with pyside():
from Qt import QtWidgets, load_ui

class MainWindow(QtWidgets.QMainWindow):
def __init__(self, parent=None):
QtWidgets.QMainWindow.__init__(self, parent)
load_ui(fname, self)
class MainWindow(QtWidgets.QMainWindow):
def __init__(self, parent=None):
QtWidgets.QMainWindow.__init__(self, parent)
load_ui(fname, self)

app = QtWidgets.QApplication(sys.argv)
window = MainWindow()
app = QtWidgets.QApplication(sys.argv)
window = MainWindow()

# Inherited from .ui file
assert hasattr(window, "pushButton")
# Inherited from .ui file
assert hasattr(window, "pushButton")


def test_load_ui_into_self_pyqt4():
"""load_ui: Load widgets into self using PyQt4"""

with ui() as fname:
with pyqt4():
from Qt import QtWidgets, load_ui
with xvfb():
with ui() as fname:
with pyqt4():
from Qt import QtWidgets, load_ui

class MainWindow(QtWidgets.QMainWindow):
def __init__(self, parent=None):
QtWidgets.QMainWindow.__init__(self, parent)
load_ui(fname, self)
class MainWindow(QtWidgets.QMainWindow):
def __init__(self, parent=None):
QtWidgets.QMainWindow.__init__(self, parent)
load_ui(fname, self)

app = QtWidgets.QApplication(sys.argv)
window = MainWindow()
app = QtWidgets.QApplication(sys.argv)
window = MainWindow()

# Inherited from .ui file
assert hasattr(window, "pushButton")
# Inherited from .ui file
assert hasattr(window, "pushButton")


def test_load_ui_into_custom_pyside():
"""load_ui: Load .ui file"""
"""load_ui: Load .ui file into custom using PySide"""

with ui() as fname:
with pyside():
from Qt import QtWidgets, load_ui
with xvfb():
with ui() as fname:
with pyside():
from Qt import QtWidgets, load_ui

app = QtWidgets.QApplication(sys.argv)
widget = load_ui(fname)
app = QtWidgets.QApplication(sys.argv)
widget = load_ui(fname)

# From .ui file
assert hasattr(widget, "pushButton")
# From .ui file
assert hasattr(widget, "pushButton")


def test_load_ui_into_custom_pyqt4():
"""load_ui: Load widgets into custom using PyQt4"""

with ui() as fname:
with pyqt4():
from Qt import QtWidgets, load_ui
with xvfb():
with ui() as fname:
with pyqt4():
from Qt import QtWidgets, load_ui

app = QtWidgets.QApplication(sys.argv)
widget = load_ui(fname)
app = QtWidgets.QApplication(sys.argv)
widget = load_ui(fname)

# From .ui file
assert hasattr(widget, "pushButton")
# From .ui file
assert hasattr(widget, "pushButton")


if PYTHON == 2:
Expand Down