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

feature prepared for py311 #1923

Merged
merged 27 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
&& source /opt/conda/etc/profile.d/conda.sh \
&& source /opt/conda/etc/profile.d/mamba.sh \
&& mamba activate mss-${{ inputs.branch_name }}-env \
&& pytest -vv -n 6 --dist loadfile --max-worker-restart 0 tests \
&& pytest -vv -n 6 --dist loadfile --max-worker-restart 4 tests \
|| (for i in {1..5} \
Copy link
Member Author

Choose a reason for hiding this comment

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

solves the situation when a worker errors. without all tests of that worker in the queue would be skipped

; do pytest -vv -n 6 --dist loadfile --max-worker-restart 0 tests --last-failed --lfnf=none \
&& break \
Expand Down
1 change: 0 additions & 1 deletion conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ def fail_if_open_message_boxes_left():
except RuntimeError:
pass


Copy link
Collaborator

Choose a reason for hiding this comment

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

This change seems wrong to me. Top-level functions should be separated by 2 newlines according to pep8.

Copy link
Member Author

Choose a reason for hiding this comment

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

ouch, but there are more

#2093

@pytest.fixture(scope="session", autouse=True)
def configure_testsetup(request):
if Display is not None:
Expand Down
6 changes: 3 additions & 3 deletions localbuild/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ requirements:
- chameleon
- execnet
- fastkml =0.11
- shapely <2.0.0
- shapely >=2.0.0
- pygeoif <1.0.0
- isodate
- lxml
- netcdf4
- hdf4
- pillow
- pytz
- pyqt >=5, <5.13
- qt >=5.10, <5.13
- pyqt >=5.15.0
Copy link
Member Author

Choose a reason for hiding this comment

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

this is needed to get recent python versions used. This also enables updating a lot dependent packages.

- qt >=5.15.0
- requests >=2.31.0
- scipy
- skyfield >=1.12
Expand Down
4 changes: 2 additions & 2 deletions tests/_test_msui/test_mss.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
See the License for the specific language governing permissions and
limitations under the License.
"""


import pytest
import sys
from PyQt5 import QtWidgets, QtTest, QtCore
from mslib.msui import mss


@pytest.mark.skip(reason='needs review, assert missing')
def test_mss_rename_message():
application = QtWidgets.QApplication(sys.argv)
main_window = mss.MSSMainWindow()
Expand Down
3 changes: 1 addition & 2 deletions tests/_test_msui/test_wms_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,9 @@ def test_invalid_url(self, mockbox):
self.query_server(f"http://???127.0.0.1:{self.port}")
assert mockbox.critical.call_count == 1

@pytest.mark.skip("problem in urllib3")
@mock.patch("PyQt5.QtWidgets.QMessageBox")
def test_connection_error(self, mockbox):
if sys.version_info.major == 3:
pytest.skip("problem in urllib3")
"""
assert that a message box informs about server troubles
"""
Expand Down
6 changes: 6 additions & 0 deletions tests/_test_utils/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,16 @@ def test_keyring():


def test_get_auth_from_url_and_name():
# set start condition to prevent definitions from a test earlier
constants.AUTH_LOGIN_CACHE == {}
# empty http_auth definition
server_url = "http://example.com"
http_auth = config_loader(dataset="MSS_auth")
assert http_auth == {}
data = auth.get_auth_from_url_and_name(server_url, http_auth, overwrite_login_cache=False)
assert data == (None, None)
# checking if the test setup changes this
assert constants.AUTH_LOGIN_CACHE == {}
Copy link
Member Author

Choose a reason for hiding this comment

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

this test on github sometimes seems like to have a bias from another test, related to TestMigration. It happens only here in serial tests. And it does not happen on each run. In that case at some point constants.AUTH_LOGIN_CACHE is not empty.

# auth username and url defined
auth_username = 'mss'
create_msui_settings_file(f'{{"MSS_auth": {{"http://example.com": "{auth_username}"}}}}')
Expand All @@ -63,6 +67,8 @@ def test_get_auth_from_url_and_name():
data = auth.get_auth_from_url_and_name(server_url, http_auth, overwrite_login_cache=False)
# no password yet
assert data == (auth_username, None)
# checking if the test setup changes this
assert constants.AUTH_LOGIN_CACHE == {}
# store a password
auth.save_password_to_keyring(server_url, auth_username, "password")
# return the test password
Expand Down