Skip to content

Commit cf75411

Browse files
committed
Update ci.yml: Simulating display and updating test
1 parent 6b9b44d commit cf75411

File tree

7 files changed

+49
-27
lines changed

7 files changed

+49
-27
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ jobs:
1616
matrix:
1717
python-version: ["3.10", "3.11", "3.12", "3.13"]
1818
env:
19-
QT_QPA_PLATFORM: offscreen
19+
QT_QPA_PLATFORM: offscreen
20+
DISPLAY: ':99.0'
2021
steps:
2122
- uses: actions/checkout@v4
2223
- name: Set up Python ${{ matrix.python-version }}
@@ -41,10 +42,15 @@ jobs:
4142
- name: Export Pythonpath and run tests using pip-installation
4243
run: |
4344
export PYTHONPATH=""
44-
sudo apt update && sudo apt install -y libegl1
45+
sudo apt update
46+
sudo apt install -y libegl1 xvfb \
47+
libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 \
48+
libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0
49+
Xvfb :99 -screen 0 1920x1080x24 -ac &
50+
sleep 3
4551
pip install .[gui]
4652
echo $(which pypef)
47-
python -m pytest ./tests/ -v -m "not main_script_specific"
53+
python -m pytest ./tests/ -v -m "not main_script_specific" --capture=tee-sys --log-cli-level=INFO
4854
4955
windows:
5056
name: windows
@@ -82,5 +88,5 @@ jobs:
8288
$env:PYTHONPATH = ""
8389
pip install .[gui]
8490
echo (Get-Command pypef).Source
85-
python -m pytest .\tests -v -m "not main_script_specific"
91+
python -m pytest .\tests -v -m "not main_script_specific" --capture=tee-sys --log-cli-level=INFO
8692

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Python3127/*
99
python-3.12.7-amd64.exe
1010
run_pypef_gui.bat
1111
run_pypef_gui.sh
12+
qt_window.spec
1213

1314
# Byte-compiled / optimized / DLL files
1415
__pycache__/

build_with_pyinstaller.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#!/bin/bash
2-
pip install -r requirements.txt
3-
pip install -U pyinstaller pyside6
4-
pip install -e .
2+
set -e
3+
pip install pyinstaller
4+
pip install -e .[gui]
55
pyinstaller \
66
--console \
77
--noconfirm \
8+
--paths "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" \
89
--collect-data pypef \
910
--collect-all pypef \
1011
--collect-data torch \
@@ -13,5 +14,6 @@ pyinstaller \
1314
--collect-data torch_geometric \
1415
--collect-all torch_geometric \
1516
--hidden-import torch_geometric \
16-
gui/PyPEFGUIQtWindow.py
17-
# --add-data=X/:X/. \
17+
--hidden-import docopt \
18+
--exclude-module PyQt5 \
19+
pypef/gui/qt_window.py

pypef/gui/qt_window.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from os import getcwd, cpu_count, chdir
88
import logging
99

10-
from PySide6.QtCore import QObject, QThread, QSize, Qt, QRect, QTimer, Signal, Slot
10+
from PySide6.QtCore import QObject, QThread, QSize, Qt, QRect, QTimer, Signal, Slot, QMetaObject
1111
from PySide6.QtWidgets import (
1212
QApplication, QPushButton, QTextEdit, QVBoxLayout, QWidget,
1313
QGridLayout, QLabel, QPlainTextEdit, QSlider, QComboBox, QFileDialog
@@ -137,15 +137,16 @@ def __init__(self, id_: int):
137137
self.timer = QTimer(self)
138138
self.timer.setInterval(100)
139139
self.timer.timeout.connect(self.on_timeout)
140-
print(self.__id)
141140

142141
self.sig_abort.connect(self.stop)
143142

144143
def start(self):
145144
self.timer.start()
146145

146+
@Slot()
147147
def stop(self):
148148
self.abort=True
149+
self.timer.stop()
149150

150151
@Slot()
151152
def on_timeout(self):
@@ -155,7 +156,6 @@ def on_timeout(self):
155156
self.timer.stop()
156157

157158

158-
159159
class SecondWindow(QWidget):
160160
def __init__(self):
161161
super().__init__()
@@ -721,7 +721,9 @@ def closeEvent(self, event):
721721
stop InfoWorker and associated threads
722722
"""
723723
for thread, worker in self.__info_threads:
724-
worker.stop()
724+
worker.sig_abort.emit() # stops timer
725+
QMetaObject.invokeMethod(worker, "stop", Qt.QueuedConnection)
726+
#worker.stop()
725727
thread.quit()
726728
thread.wait()
727729
event.accept()

scripts/CLI/run_cli_tests_linux.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ $pypef ml -e onehot -m ONEHOT -p 37_ANEH_variants_prediction_set.fasta
188188
echo
189189
$pypef ml -e dca -m MLPLMC -p 37_ANEH_variants_prediction_set.fasta --params ANEH_72.6.params --threads $threads
190190
echo
191-
$pypef ml -e dca -m MLgremlin -p 37_ANEH_variants_prediction_set.fasta --params GREMLIN
191+
$pypef ml -e dca -m MLGREMLIN -p 37_ANEH_variants_prediction_set.fasta --params GREMLIN
192192
echo
193193

194194
$pypef mkps -i 37_ANEH_variants.csv -w Sequence_WT_ANEH.fasta --drecomb --trecomb --qarecomb --qirecomb --ddiverse
@@ -199,7 +199,7 @@ $pypef ml -e onehot -m ONEHOT --pmult --drecomb --trecomb --qarecomb --qirecomb
199199
echo
200200
$pypef ml -e dca -m MLPLMC --params ANEH_72.6.params --pmult --drecomb --trecomb --qarecomb --qirecomb --ddiverse --threads $threads
201201
echo
202-
$pypef ml -e dca -m MLgremlin --params GREMLIN --pmult --drecomb --trecomb --qarecomb --qirecomb --ddiverse
202+
$pypef ml -e dca -m MLGREMLIN --params GREMLIN --pmult --drecomb --trecomb --qarecomb --qirecomb --ddiverse
203203
echo
204204

205205
$pypef ml -e aaidx directevo -m FAUJ880104 -w Sequence_WT_ANEH.fasta --negative
@@ -208,23 +208,23 @@ $pypef ml -e onehot directevo -m ONEHOT -w Sequence_WT_ANEH.fasta --negative
208208
echo
209209
$pypef ml -e dca directevo -m MLPLMC -w Sequence_WT_ANEH.fasta --negative --params ANEH_72.6.params
210210
echo
211-
$pypef ml -e dca directevo -m MLgremlin -w Sequence_WT_ANEH.fasta --negative --params GREMLIN
211+
$pypef ml -e dca directevo -m MLGREMLIN -w Sequence_WT_ANEH.fasta --negative --params GREMLIN
212212
echo
213213
$pypef ml -e aaidx directevo -m FAUJ880104 -w Sequence_WT_ANEH.fasta --numiter 10 --numtraj 8 --negative
214214
echo
215215
$pypef ml -e onehot directevo -m ONEHOT -w Sequence_WT_ANEH.fasta --numiter 10 --numtraj 8 --negative
216216
echo
217217
$pypef ml -e dca directevo -m MLPLMC -w Sequence_WT_ANEH.fasta --numiter 10 --numtraj 8 --negative --params ANEH_72.6.params
218218
echo
219-
$pypef ml -e dca directevo -m MLgremlin -w Sequence_WT_ANEH.fasta --numiter 10 --numtraj 8 --negative --params GREMLIN
219+
$pypef ml -e dca directevo -m MLGREMLIN -w Sequence_WT_ANEH.fasta --numiter 10 --numtraj 8 --negative --params GREMLIN
220220
echo
221221
$pypef ml -e aaidx directevo -m FAUJ880104 -i 37_ANEH_variants.csv -w Sequence_WT_ANEH.fasta --temp 0.1 --usecsv --csvaa --negative
222222
echo
223223
$pypef ml -e onehot directevo -m ONEHOT -i 37_ANEH_variants.csv -w Sequence_WT_ANEH.fasta --temp 0.1 --usecsv --csvaa --negative
224224
echo
225225
$pypef ml -e dca directevo -m MLPLMC -i 37_ANEH_variants.csv -w Sequence_WT_ANEH.fasta --temp 0.1 --usecsv --csvaa --negative --params ANEH_72.6.params
226226
echo
227-
$pypef ml -e dca directevo -m MLgremlin -i 37_ANEH_variants.csv -w Sequence_WT_ANEH.fasta --temp 0.1 --usecsv --csvaa --negative --params GREMLIN
227+
$pypef ml -e dca directevo -m MLGREMLIN -i 37_ANEH_variants.csv -w Sequence_WT_ANEH.fasta --temp 0.1 --usecsv --csvaa --negative --params GREMLIN
228228
echo
229229

230230
$pypef ml -e aaidx -l LS.fasl -t TS.fasl --regressor pls --nofft
@@ -371,7 +371,7 @@ echo
371371
# ml only TS
372372
$pypef ml -e dca -m MLPLMC -t TS.fasl --params uref100_avgfp_jhmmer_119_plmc_42.6.params --threads $threads
373373
echo
374-
$pypef ml -e dca -m MLgremlin -t TS.fasl --params GREMLIN --threads $threads
374+
$pypef ml -e dca -m MLGREMLIN -t TS.fasl --params GREMLIN --threads $threads
375375
echo
376376

377377
echo
@@ -420,7 +420,7 @@ $pypef ml extrapolation -i avGFP_dca_encoded.csv --conc --regressor ridge
420420
echo
421421

422422
# Direct Evo
423-
$pypef ml -e dca directevo -m MLgremlin --wt P42212_F64L.fasta --params GREMLIN
423+
$pypef ml -e dca directevo -m MLGREMLIN --wt P42212_F64L.fasta --params GREMLIN
424424
echo
425425
$pypef ml -e dca directevo -m MLPLMC --wt P42212_F64L.fasta --params PLMC
426426
echo

scripts/ProteinGym_runs/results/dca_esm_and_hybrid_5cv-split_results.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,4 @@ No.,Dataset,N_Variants,N_Max_Muts,Untrained_Performance_DCA,Untrained_Performanc
9999
98,PTEN_HUMAN_Matreyek_2021,5083,1,5083 variant fitness pairs (below 50 or more than 600)
100100
99,PTEN_HUMAN_Mighell_2018,7260,1,7260 variant fitness pairs (below 50 or more than 600)
101101
100,Q2N0S5_9HIV1_Haddox_2018,12729,1,12729 variant fitness pairs (below 50 or more than 600)
102+
101,Q53Z42_HUMAN_McShan_2019_binding-TAPBPR,3344,1,0.30236928959118303,0.29758327493409265,0.4106333338290412,0.6155205938174899,0.5444802039870617,0.6170146816336404,0.6841040378864747,0.6228855033907258,0.7376342898806972,0.6913379495934746,0.7218016750905504,0.7686186339141997,0.7389457134749116,0.7567534270430136,0.6903353390849041,0.7280497034445114,0.7735694641206315,0.7549957977525813,0.5139437438254881,0.5181436876214243,0.4950673026256684,0.5372292645433243,0.43241860553191147,0.6610097448927186,0.6356562004856172,0.6134093858334889,0.6524652693992385,0.6536614941027378,0.6835604290538351,0.7152345717487829,0.6312263783941386,0.673532765455087,0.626163763305635,0.5172693562317241,0.1946017580527397,0.3734633407764436,0.01692976911480976,0.11444276706135406,0.6458416916777189,0.5087226916123205,0.5269873470447384,0.40650371604050123,0.4986505696835808,0.6884670213733808,0.5342668214178948,0.6272054182572798,0.44182216770593896,0.5223171913551616,32309

tests/gui/test_gui_functions.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
import sys
42
import tempfile
53
import pytest
@@ -8,18 +6,31 @@
86
from pypef import __version__
97

108

11-
129
@pytest.fixture(scope="session")
1310
def app():
11+
"""Create and return a QApplication for all tests in the session."""
1412
from PySide6.QtWidgets import QApplication
15-
return QApplication(sys.argv)
13+
app = QApplication.instance()
14+
if app is None:
15+
app = QApplication(sys.argv)
16+
yield app # No explicit teardown needed for QApplication
1617

1718

18-
@pytest.mark.pip_specific
19-
def test_button_click_changes_label(app):
19+
@pytest.fixture
20+
def main_window(app):
2021
from pypef.gui.qt_window import MainWidget
2122
window = MainWidget()
2223
window.show()
24+
yield window
25+
26+
window.close()
27+
app.processEvents()
28+
29+
30+
#@pytest.mark.skipif(os.environ.get("CI") == "true", reason="Skipping GUI test in CI")
31+
@pytest.mark.pip_specific
32+
def test_button_click_changes_label(main_window, app):
33+
window = main_window
2334

2435
assert window.version_text.text() == f"PyPEF v. {__version__}"
2536

@@ -30,4 +41,3 @@ def test_button_click_changes_label(app):
3041

3142
assert hasattr(window, "working_directory")
3243
assert window.working_directory == str(tmp_dir)
33-

0 commit comments

Comments
 (0)