Skip to content

Commit

Permalink
Update CI
Browse files Browse the repository at this point in the history
  • Loading branch information
daizutabi committed Jan 19, 2025
1 parent 1f29ccf commit d3af8a3
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
python-version: ["3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4
Expand All @@ -36,7 +36,7 @@ jobs:
- name: Install the project
run: uv sync
- name: Run test
run: uv run pytest --junitxml=junit.xml
run: uv run pytest tests\axes -x --junitxml=junit.xml
- name: Upload Codecov Results
if: success()
uses: codecov/codecov-action@v4
Expand Down
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ readme = "README.md"
license = { file = "LICENSE" }
classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
requires-python = ">=3.10"
requires-python = ">=3.11"
dependencies = [
"pywin32>=308",
"xlwings>=0.33",
Expand Down Expand Up @@ -44,10 +44,12 @@ exclude = ["/.github", "/docs"]
packages = ["src/xlviews"]

[tool.pytest.ini_options]
markers = ["app: mark test as app"]
addopts = [
"--doctest-modules",
"--cov=xlviews",
"--cov-report=lcov:lcov.info",
"--strict-markers",
"-p no:faulthandler",
]
doctest_optionflags = ["NORMALIZE_WHITESPACE", "IGNORE_EXCEPTION_DETAIL"]
Expand Down
16 changes: 14 additions & 2 deletions src/xlviews/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
import re
import warnings
from collections import OrderedDict
from functools import cache
from typing import TYPE_CHECKING

import matplotlib as mpl
import xlwings as xw
from pywintypes import com_error
from xlwings import Range
from xlwings.constants import DVType, FormatConditionOperator

Expand All @@ -20,6 +22,17 @@
from xlviews.sheetframe import SheetFrame


@cache
def is_excel_installed() -> bool:
try:
with xw.App(visible=False):
pass
except com_error:
return False

return True


def constant(type_: str, name: str | None = None) -> int:
"""Return the Excel constant.
Expand Down Expand Up @@ -219,8 +232,7 @@ def format_label(data, fmt, sel=None, default=None):
for key in keys:
if key not in dict_:
warnings.warn(
f"タイトル文字列に含まれる'{key}'が、"
"dfに含まれないか、単一ではない。",
f"タイトル文字列に含まれる'{key}'が、dfに含まれないか、単一ではない。",
)
dict_[key] = "XXX"
return fmt.format(**dict_)
Expand Down
5 changes: 5 additions & 0 deletions tests/axes/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import pytest

from xlviews.utils import is_excel_installed

pytestmark = pytest.mark.skipif(not is_excel_installed(), reason="Excel not installed")
7 changes: 2 additions & 5 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@

@pytest.fixture(scope="session")
def app():
app = xlwings.apps.add()

yield app

app.quit()
with xlwings.App(visible=False) as app:
yield app


@pytest.fixture(scope="session")
Expand Down
5 changes: 0 additions & 5 deletions tests/test_version.py

This file was deleted.

0 comments on commit d3af8a3

Please sign in to comment.