Skip to content

Commit

Permalink
Testing Improvements (#1327)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamin-kirkbride committed Jul 6, 2023
1 parent 723c555 commit af45e4a
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/autofix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
path: ./pr
- uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.11"
cache: pip
- run: pip install wheel
- run: pip install -r requirements-dev.txt
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.11"
cache: pip
- run: pip install wheel
- run: pip install -r requirements.txt -r requirements-dev.txt
Expand All @@ -26,13 +26,14 @@ jobs:
time mypy --platform darwin --python-version 3.8 porcupine docs/extensions.py
time mypy --platform darwin --python-version 3.9 porcupine docs/extensions.py
time mypy --platform darwin --python-version 3.10 porcupine docs/extensions.py
time mypy --platform darwin --python-version 3.11 porcupine docs/extensions.py
pytest:
timeout-minutes: 10
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest"]
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -60,7 +61,7 @@ jobs:
runs-on: macos-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
env:
# TODO: how to install tkdnd on mac? add instructions to README or make mac app that bundles it
TCLLIBPATH: ./lib
Expand All @@ -82,7 +83,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.11"
cache: pip
# TODO: adding these to requirements-dev.txt breaks pip install
- run: pip install flake8==5.0.4 flake8-tkinter==0.5.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.11"
cache: pip
- run: pip install wheel
- run: pip install -r requirements.txt -r requirements-dev.txt
Expand Down
7 changes: 5 additions & 2 deletions tests/test_fullscreen_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
from porcupine import get_main_window
from porcupine.menubar import get_menu

headless = os.getenv("GITHUB_ACTIONS") == "true" or "xvfb" in os.getenv("XAUTHORITY", "")


pytestmark = pytest.mark.skipif(headless, reason="Does not work in headless environments")


@pytest.mark.skipif(os.getenv("GITHUB_ACTIONS") == "true", reason="fails CI on all platforms")
def test_basic(wait_until):
assert not get_main_window().attributes("-fullscreen")

Expand All @@ -18,7 +22,6 @@ def test_basic(wait_until):


# Window managers can toggle full-screen-ness without going through our menubar
@pytest.mark.skipif(os.getenv("GITHUB_ACTIONS") == "true", reason="fails CI on all platforms")
def test_toggled_without_menu_bar(wait_until):
get_main_window().attributes("-fullscreen", 1)
wait_until(lambda: bool(get_main_window().attributes("-fullscreen")))
Expand Down
8 changes: 8 additions & 0 deletions tests/test_jump_to_definition_plugin.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
# TODO: create much more tests for langserver
import sys
import time

import pytest
from sansio_lsp_client import ClientState

from porcupine import get_main_window
from porcupine.plugins.langserver import langservers

pytestmark = pytest.mark.xfail(
sys.version_info >= (3, 11),
strict=True,
reason="https://github.com/Akuli/porcupine/issues/1300",
)


def langserver_started(filetab):
return lambda: any(
Expand Down
4 changes: 2 additions & 2 deletions tests/test_run_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def test_python_unbuffered(tmp_path, wait_until):
no_terminal.run_command(f"{utils.quote(sys.executable)} sleeper.py", tmp_path)
wait_until(lambda: "This should show up immediately" in get_output())
end = time.monotonic()
assert end - start < 8
assert end - start < 9


def test_not_line_buffered(tmp_path, wait_until):
Expand All @@ -321,7 +321,7 @@ def test_not_line_buffered(tmp_path, wait_until):
no_terminal.run_command(f"{utils.quote(sys.executable)} sleeper.py", tmp_path)
wait_until(lambda: "This should show up immediately" in get_output())
end = time.monotonic()
assert end - start < 8
assert end - start < 9


def test_crlf_on_any_platform(tmp_path, wait_until):
Expand Down

0 comments on commit af45e4a

Please sign in to comment.