Skip to content

Commit

Permalink
Disable no site packages (#2103)
Browse files Browse the repository at this point in the history
  • Loading branch information
JackEAllen authored Mar 13, 2024
2 parents bb51655 + ac8fa21 commit 8cf0f82
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 12 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,8 @@ jobs:
- name: mypy
shell: bash -l {0}
# COMPAT: applitools has some bad signatures, so use --no-site-packages
run: |
mypy --ignore-missing-imports --no-site-packages mantidimaging
mypy --ignore-missing-imports mantidimaging
- name: pytest
timeout-minutes: 10
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/cos7_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ jobs:
- name: mypy
uses: ./.github/actions/test
with:
# COMPAT: applitools has some bad signatures, so use --no-site-packages
command: mypy --ignore-missing-imports --no-site-packages mantidimaging
command: mypy --ignore-missing-imports mantidimaging
label: centos7

- name: pytest
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/u18_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ jobs:
- name: mypy
uses: ./.github/actions/test
with:
# COMPAT: applitools has some bad signatures, so use --no-site-packages
command: mypy --ignore-missing-imports --no-site-packages mantidimaging
command: mypy --ignore-missing-imports mantidimaging
label: ubuntu18

- name: pytest
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,8 @@ jobs:
- name: mypy
shell: bash -l {0}
# COMPAT: applitools has some bad signatures, so use --no-site-packages
run: |
mypy --ignore-missing-imports --no-site-packages mantidimaging
mypy --ignore-missing-imports mantidimaging
- name: pytest
timeout-minutes: 10
Expand Down
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ repos:
hooks:
- id: mypy
files: ^mantidimaging/
args: [--ignore-missing-imports, --no-site-packages]
args: [--ignore-missing-imports]
additional_dependencies: [types-docutils, types-PyYAML, types-requests]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.2
hooks:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ test-screenshots-win:
@echo "Screenshots writen to" ${TEST_RESULT_DIR}

mypy:
python -m mypy --ignore-missing-imports --no-site-packages ${SOURCE_DIRS}
python -m mypy --ignore-missing-imports ${SOURCE_DIRS}

yapf:
python -m yapf --parallel --diff --recursive ${SOURCE_DIRS}
Expand Down
1 change: 1 addition & 0 deletions docs/release_notes/next/dev-2008-mypy-site-packages
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#2008: Update mypy, remove --no-site-packages, fix issues
3 changes: 3 additions & 0 deletions environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ dependencies:
- eyes-images==5.20.*
- yapf==0.40.*
- mypy==1.8
- types-requests
- types-PyYAML
- types-docutils
- pytest==7.4.*
- pytest-cov==4.1.*
- pytest-randomly==3.15.*
Expand Down
11 changes: 9 additions & 2 deletions mantidimaging/eyes_tests/eyes_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,23 @@
import os
import sys
from tempfile import mkdtemp
from typing import TYPE_CHECKING, Any
from unittest import mock
from uuid import uuid4

from PyQt5.QtWidgets import QWidget, QApplication
from PyQt5.QtTest import QTest
from applitools.common import BatchInfo, MatchLevel
from applitools.images import Eyes

from mantidimaging.gui.windows.main import MainWindowView

# COMPAT: applitools has some bad signatures, so avoid importing it when type checking
# See https://github.com/mantidproject/mantidimaging/issues/2008
if not TYPE_CHECKING:
from applitools.common import BatchInfo, MatchLevel
from applitools.images import Eyes
else:
MatchLevel = Any

# Used to disabiguate tests on the Applitools platform. set explicitly to avoid depending on the window size
VIEWPORT_WIDTH = 1920
VIEWPORT_HEIGHT = 1080
Expand Down

0 comments on commit 8cf0f82

Please sign in to comment.