Skip to content

Commit

Permalink
Merge branch 'main' into use-process-communicate-instead-of-wait
Browse files Browse the repository at this point in the history
  • Loading branch information
oxy-star authored Nov 7, 2024
2 parents aec7dbc + e755311 commit 8946451
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 19 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ name: Upload Python Package
on:
release:
types: [published]
workflow_dispatch:
jobs:
deploy-conda:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
Expand All @@ -23,7 +25,7 @@ jobs:
# Required for conda-incubator/setup-miniconda@v3
shell: bash -el {0}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get conda
Expand All @@ -33,8 +35,7 @@ jobs:
channels: conda-forge
miniconda-version: latest
- name: Prepare
# Pinned because of https://github.com/conda/conda-build/issues/5267
run: conda install anaconda-client conda-build=24.1.2 conda-verify py-lief=0.12.3
run: conda install anaconda-client conda-build conda-verify
- name: Build and Upload
env:
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }}
Expand All @@ -43,7 +44,8 @@ jobs:
if [ "${{ matrix.target-platform }}" == "osx-arm64" ]; then
conda build --user microsoft . -m conda_build_config_osx_arm64.yaml
elif [ "${{ matrix.target-platform }}" == "linux-aarch64" ]; then
conda install cross-python_linux-aarch64
# Needs to be pinned until https://github.com/conda-forge/cross-python-feedstock/issues/93 is resolved.
conda install cross-python_linux-aarch64=3.12=47_cpython
conda build --user microsoft . -m conda_build_config_linux_aarch64.yaml
else
conda build --user microsoft .
Expand Down
2 changes: 1 addition & 1 deletion local-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pixelmatch==0.3.0
pre-commit==3.5.0
pyOpenSSL==24.2.1
pytest==8.3.3
pytest-asyncio==0.21.2
pytest-asyncio==0.24.0
pytest-cov==6.0.0
pytest-repeat==0.9.3
pytest-timeout==2.3.1
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ markers = [
]
junit_family = "xunit2"
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "session"

[tool.mypy]
ignore_missing_imports = true
Expand Down
11 changes: 7 additions & 4 deletions tests/async/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from typing import Any, AsyncGenerator, Awaitable, Callable, Dict, Generator, List

import pytest
from pytest_asyncio import is_async_test

from playwright.async_api import (
Browser,
Expand All @@ -38,8 +39,10 @@ def utils() -> Generator[Utils, None, None]:

# Will mark all the tests as async
def pytest_collection_modifyitems(items: List[pytest.Item]) -> None:
for item in items:
item.add_marker(pytest.mark.asyncio)
pytest_asyncio_tests = (item for item in items if is_async_test(item))
session_scope_marker = pytest.mark.asyncio(loop_scope="session")
for async_test in pytest_asyncio_tests:
async_test.add_marker(session_scope_marker, append=False)


@pytest.fixture(scope="session")
Expand Down Expand Up @@ -85,7 +88,7 @@ async def browser(


@pytest.fixture(scope="session")
async def browser_version(browser: Browser) -> str:
def browser_version(browser: Browser) -> str:
return browser.version


Expand All @@ -106,7 +109,7 @@ async def launch(**kwargs: Any) -> BrowserContext:


@pytest.fixture(scope="session")
async def default_same_site_cookie_value(browser_name: str, is_linux: bool) -> str:
def default_same_site_cookie_value(browser_name: str, is_linux: bool) -> str:
if browser_name == "chromium":
return "Lax"
if browser_name == "firefox":
Expand Down
12 changes: 2 additions & 10 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import asyncio
import inspect
import io
import json
import os
import subprocess
import sys
from pathlib import Path
from typing import Any, AsyncGenerator, Callable, Dict, Generator, List, Optional, cast
from typing import Any, Callable, Dict, Generator, List, Optional, cast

import pytest
from PIL import Image
Expand All @@ -41,13 +40,6 @@ def pytest_generate_tests(metafunc: pytest.Metafunc) -> None:
metafunc.parametrize("browser_name", browsers, scope="session")


@pytest.fixture(scope="session")
def event_loop() -> Generator[asyncio.AbstractEventLoop, None, None]:
loop = asyncio.get_event_loop()
yield loop
loop.close()


@pytest.fixture(scope="session")
def assetdir() -> Path:
return _dirname / "assets"
Expand Down Expand Up @@ -77,7 +69,7 @@ def https_server() -> Generator[Server, None, None]:


@pytest.fixture(autouse=True, scope="session")
async def start_server() -> AsyncGenerator[None, None]:
def start_server() -> Generator[None, None, None]:
test_server.start()
yield
test_server.stop()
Expand Down

0 comments on commit 8946451

Please sign in to comment.