Skip to content
This repository was archived by the owner on Oct 12, 2020. It is now read-only.

Commit aeabc1e

Browse files
authored
Merge pull request #7 from sumagnadas/dependabot/pip/pyside2-5.15.0
Bump pyside2 from 5.14.2 to 5.15.0
2 parents b6a461a + 76778df commit aeabc1e

File tree

4 files changed

+49
-28
lines changed

4 files changed

+49
-28
lines changed

.travis.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,20 @@ jobs:
3636
addons:
3737
apt:
3838
packages:
39-
- build-essential
40-
- libssl-dev
41-
- libffi-dev
4239
- x11-utils
4340
- libxkbcommon-x11-0
41+
- libxcb-keysyms1-dev
42+
- libx11-xcb-dev
43+
- libxcb-xinerama0-dev
44+
- libxcb-randr0-dev
45+
- libxcb-render0-dev
46+
- libxcb-image0-dev
47+
- libxcb-icccm4-dev
48+
- libxcb-render-util0-dev
4449
install:
4550
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then py -m pip install -r requirements.txt; fi
46-
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then pip3 install -r requirements.txt; fi
51+
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then export DISPLAY=:99.0; /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1920x1200x24 -ac +extension GLX +render -noreset;sleep 3;pip3 install -r requirements.txt; fi
4752
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then pip3 install -r requirements.txt; fi
4853
script:
49-
- coverage run -m pytest -vxrs
54+
- pytest -vxrs --cov=./
5055
- codecov

requirements.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ pluggy==0.13.1
88
py==1.8.2
99
pycodestyle==2.6.0
1010
pyparsing==2.4.7
11-
PySide2==5.14.2
11+
PySide2==5.15.0
1212
pytest==5.4.3
1313
pytest-qt==3.3.0
14-
shiboken2==5.14.2
14+
shiboken2==5.15.0
1515
wcwidth==0.1.9
1616
zipp==3.1.0
1717
codecov==2.1.7
1818
coverage==5.1
19+
pytest-cov==2.10.0

tests/test_button.py

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
11
import pytestqt
2-
from modules.gui import Graph, QtWidgets, QtGui
2+
from modules.gui import Graph, QtGui, QtWidgets
33
from modules.geometry import dist, Point
44
from modules import configureImage
55
from PySide2.QtCore import Qt, QPoint
66
from os import path
77

8-
app = QtWidgets.QApplication()
9-
rect = app.primaryScreen().availableGeometry()
10-
WIDTH = int(rect.width() * (43.92 / 100))
11-
HEIGHT = int(rect.height() * (80.97 / 100))
8+
def test_coordBox(qtbot, qapp):
9+
print(qapp.instance())
10+
window = Graph()
11+
window.setImage(QtGui.QImage("resources/graph.png"))
1212

13-
image = configureImage(WIDTH, HEIGHT)
14-
window = Graph()
15-
window.setImage(image)
16-
17-
def test_coordBox(qtbot):
18-
window.show()
1913
str = ('Empty '
2014
'input box should be taken as zero')
2115

@@ -30,8 +24,9 @@ def test_coordBox(qtbot):
3024
assert i[0].text() == '0', str
3125
assert i[1].text() == '0', str
3226

33-
def test_draw(qtbot):
34-
window.show()
27+
def test_draw(qtbot, qapp):
28+
window = Graph()
29+
window.setImage(QtGui.QImage("resources/graph.png"))
3530

3631
window.x_coord1.setText('10')
3732
window.y_coord1.setText('10')
@@ -40,8 +35,7 @@ def test_draw(qtbot):
4035
qtbot.waitForWindowShown(window)
4136

4237
qtbot.mouseClick(window.buttonBox.buttons()[0], Qt.LeftButton)
43-
graph = window.image.grab().toImage()
44-
app.exit()
38+
graph = window.graph_image
4539
for i in range(-20, 20):
4640
for j in range(-20, 20):
4741
p = Point(i, j)
@@ -51,12 +45,15 @@ def test_draw(qtbot):
5145
'not working')
5246

5347

54-
def test_save(qtbot, tmpdir_factory):
48+
def test_save(qtbot, qapp, tmpdir_factory):
49+
window = Graph()
50+
window.setImage(QtGui.QImage("resources/graph.png"))
51+
5552
window.x_coord1.setText('10')
5653
window.y_coord1.setText('10')
5754
window.x_coord2.setText('20')
5855
window.y_coord2.setText('20')
59-
qtbot.waitForWindowShown(window)
56+
window.setImage(QtGui.QImage("resources/graph.png"))
6057

6158
window.beingTested = True
6259
fn = tmpdir_factory.mktemp("data")
@@ -67,7 +64,10 @@ def test_save(qtbot, tmpdir_factory):
6764
assert fn.join("img.png").check() is True, ('Save button '
6865
'is not working')
6966

70-
def test_intInput(qtbot):
67+
def test_intInput(qtbot, qapp):
68+
window = Graph()
69+
window.setImage(QtGui.QImage("resources/graph.png"))
70+
7171
qtbot.addWidget(window)
7272
str = 'Coordinates input box is not supposed take in letter as input'
7373

@@ -82,8 +82,11 @@ def test_intInput(qtbot):
8282
assert 'A' not in i[0].text(), str
8383
assert 'A' not in i[1].text(), str
8484

85-
def test_bgchange(qtbot):
85+
def test_bgchange(qtbot, qapp):
86+
WIDTH = 599
87+
HEIGHT = 599
8688
image = configureImage(WIDTH, HEIGHT, backgroundcolour=Qt.red)
89+
8790
gridColor = 0
8891
bgColor = 0
8992
image = image.scaled(WIDTH, HEIGHT)
@@ -97,8 +100,11 @@ def test_bgchange(qtbot):
97100

98101
assert (bgColor > gridColor) is True, 'Background colour of the graph is not getting changed'
99102

100-
def test_gridchange(qtbot):
103+
def test_gridchange(qtbot, qapp):
104+
WIDTH = 599
105+
HEIGHT = 599
101106
image = configureImage(WIDTH, HEIGHT, gridcolour=Qt.red, backgroundcolour=Qt.transparent)
107+
102108
gridColor = 0
103109
bgColor = 0
104110
image = image.scaled(WIDTH, HEIGHT)

tests/test_misc.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
from os import path
55

66

7-
window = Graph()
87
def test_closedfigure(qtbot):
8+
h = QtWidgets.QApplication.instance()
9+
window = Graph()
910
qtbot.addWidget(window)
1011
qtbot.mouseClick(window.addButton, Qt.LeftButton)
1112
window.buttonBox.buttons()[4].setCheckState(Qt.CheckState.Unchecked)
@@ -15,17 +16,23 @@ def test_closedfigure(qtbot):
1516
qtbot.mouseClick(window.input[-1].removeButton, Qt.LeftButton)
1617

1718
def test_extrainfo(qtbot):
19+
h = QtWidgets.QApplication.instance()
20+
window = Graph()
1821
qtbot.addWidget(window)
1922
qtbot.mouseClick(window.extraInfo, Qt.LeftButton)
2023
assert window.shapeInfo.isHidden() == False, 'Extra Info is not being shown'
2124

2225
def test_removebutton(qtbot):
26+
h = QtWidgets.QApplication.instance()
27+
window = Graph()
2328
oldRowCount = window.coordLayout.rowCount()
2429
qtbot.mouseClick(window.addButton, Qt.LeftButton)
2530
qtbot.mouseClick(window.input[-1].removeButton, Qt.LeftButton)
2631
assert window.coordLayout.rowCount() == oldRowCount, "\"Remove Point\" button is not working"
2732

2833
def test_clear(qtbot):
34+
h = QtWidgets.QApplication.instance()
35+
window = Graph()
2936
window.x_coord1.setText('10')
3037
window.y_coord1.setText('10')
3138
window.x_coord2.setText('20')
@@ -39,5 +46,7 @@ def test_clear(qtbot):
3946
assert window.y_coord2.text() == '0', "Reset button is not working"
4047

4148
def test_addbutton(qtbot):
49+
h = QtWidgets.QApplication.instance()
50+
window = Graph()
4251
qtbot.mouseClick(window.addButton, Qt.LeftButton)
4352
assert window.coordLayout.rowCount() == 4, "\"Add Point\" button is not working"

0 commit comments

Comments
 (0)