-
-
Notifications
You must be signed in to change notification settings - Fork 36
fix: trying some approaches #237
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,85 @@ | |||||||||||||||||
| """Pytest configuration for json2xml tests.""" | |||||||||||||||||
| from __future__ import annotations | |||||||||||||||||
|
|
|||||||||||||||||
| import json | |||||||||||||||||
| import os | |||||||||||||||||
Check noticeCode scanning / CodeQL Unused import Note test
Import of 'os' is not used.
Copilot AutofixAI 12 months ago To fix the problem, we will remove the unused
Suggested changeset
1
tests/conftest.py
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||
| from pathlib import Path | |||||||||||||||||
| from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union | |||||||||||||||||
Check noticeCode scanning / CodeQL Unused import Note test
Import of 'Optional' is not used.
Import of 'Union' is not used.
Copilot AutofixAI 12 months ago To fix the issue, we will remove the unused
Suggested changeset
1
tests/conftest.py
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||
|
|
|||||||||||||||||
| import pytest | |||||||||||||||||
|
|
|||||||||||||||||
| if TYPE_CHECKING: | |||||||||||||||||
| from _pytest.capture import CaptureFixture | |||||||||||||||||
Check noticeCode scanning / CodeQL Unused import Note test
Import of 'CaptureFixture' is not used.
Copilot AutofixAI 12 months ago To fix the problem, we should remove the unused import statement
Suggested changeset
1
tests/conftest.py
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||
| from _pytest.fixtures import FixtureRequest | |||||||||||||||||
Check noticeCode scanning / CodeQL Unused import Note test
Import of 'FixtureRequest' is not used.
Copilot AutofixAI 12 months ago To fix the problem, we should remove the unused import statement
Suggested changeset
1
tests/conftest.py
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||
| from _pytest.logging import LogCaptureFixture | |||||||||||||||||
Check noticeCode scanning / CodeQL Unused import Note test
Import of 'LogCaptureFixture' is not used.
Copilot AutofixAI 12 months ago To fix the problem, we will remove the unused import statement
Suggested changeset
1
tests/conftest.py
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||
| from _pytest.monkeypatch import MonkeyPatch | |||||||||||||||||
Check noticeCode scanning / CodeQL Unused import Note test
Import of 'MonkeyPatch' is not used.
Copilot AutofixAI 12 months ago To fix the issue, we should remove the unused import statement
Suggested changeset
1
tests/conftest.py
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||
| from pytest_mock.plugin import MockerFixture | |||||||||||||||||
Check noticeCode scanning / CodeQL Unused import Note test
Import of 'MockerFixture' is not used.
Copilot AutofixAI 12 months ago To fix the problem, we should remove the unused import statement
Suggested changeset
1
tests/conftest.py
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||
|
|
|||||||||||||||||
|
|
|||||||||||||||||
| @pytest.fixture | |||||||||||||||||
| def sample_json_string() -> str: | |||||||||||||||||
| """Return a sample JSON string for testing. | |||||||||||||||||
|
|
|||||||||||||||||
| Returns: | |||||||||||||||||
| str: A sample JSON string | |||||||||||||||||
| """ | |||||||||||||||||
| return '{"login":"mojombo","id":1,"avatar_url":"https://avatars0.githubusercontent.com/u/1?v=4"}' | |||||||||||||||||
|
|
|||||||||||||||||
|
|
|||||||||||||||||
| @pytest.fixture | |||||||||||||||||
| def sample_json_dict() -> Dict[str, Any]: | |||||||||||||||||
| """Return a sample JSON dictionary for testing. | |||||||||||||||||
|
|
|||||||||||||||||
| Returns: | |||||||||||||||||
| Dict[str, Any]: A sample JSON dictionary | |||||||||||||||||
| """ | |||||||||||||||||
| return { | |||||||||||||||||
| "login": "mojombo", | |||||||||||||||||
| "id": 1, | |||||||||||||||||
| "avatar_url": "https://avatars0.githubusercontent.com/u/1?v=4", | |||||||||||||||||
| } | |||||||||||||||||
|
|
|||||||||||||||||
|
|
|||||||||||||||||
| @pytest.fixture | |||||||||||||||||
| def sample_json_list() -> List[Dict[str, Any]]: | |||||||||||||||||
| """Return a sample JSON list for testing. | |||||||||||||||||
|
|
|||||||||||||||||
| Returns: | |||||||||||||||||
| List[Dict[str, Any]]: A sample list of JSON dictionaries | |||||||||||||||||
| """ | |||||||||||||||||
| return [ | |||||||||||||||||
| { | |||||||||||||||||
| "login": "mojombo", | |||||||||||||||||
| "id": 1, | |||||||||||||||||
| "avatar_url": "https://avatars0.githubusercontent.com/u/1?v=4", | |||||||||||||||||
| }, | |||||||||||||||||
| { | |||||||||||||||||
| "login": "defunkt", | |||||||||||||||||
| "id": 2, | |||||||||||||||||
| "avatar_url": "https://avatars0.githubusercontent.com/u/2?v=4", | |||||||||||||||||
| }, | |||||||||||||||||
| ] | |||||||||||||||||
|
|
|||||||||||||||||
|
|
|||||||||||||||||
| @pytest.fixture | |||||||||||||||||
| def sample_json_file(tmp_path: Path) -> Path: | |||||||||||||||||
| """Create a sample JSON file for testing. | |||||||||||||||||
|
|
|||||||||||||||||
| Args: | |||||||||||||||||
| tmp_path (Path): Pytest temporary path fixture | |||||||||||||||||
|
|
|||||||||||||||||
| Returns: | |||||||||||||||||
| Path: Path to the created JSON file | |||||||||||||||||
| """ | |||||||||||||||||
| file_path = tmp_path / "sample.json" | |||||||||||||||||
|
|
|||||||||||||||||
| data = { | |||||||||||||||||
| "login": "mojombo", | |||||||||||||||||
| "id": 1, | |||||||||||||||||
| "avatar_url": "https://avatars0.githubusercontent.com/u/1?v=4", | |||||||||||||||||
| } | |||||||||||||||||
|
|
|||||||||||||||||
| with open(file_path, "w") as f: | |||||||||||||||||
| json.dump(data, f) | |||||||||||||||||
|
|
|||||||||||||||||
| return file_path | |||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,51 @@ | ||
| [tox] | ||
| envlist = py310, py311, py312, py313, pypy310, pypy311, py314-full | ||
| isolated_build = True | ||
| skip_missing_interpreters = True | ||
| parallel_show_output = True | ||
|
|
||
| [testenv] | ||
| passenv = | ||
| CI | ||
| GITHUB_* | ||
| PYTHONPATH | ||
| deps = | ||
| pytest>=8.0.0 | ||
| pytest-cov>=6.0.0 | ||
| pytest-xdist>=3.5.0 | ||
| ruff>=0.3.0 | ||
| mypy>=1.0.0 | ||
| types-setuptools | ||
|
|
||
| allowlist_externals = | ||
| pytest | ||
| pytest-cov | ||
| ruff | ||
| mypy | ||
|
|
||
| allowlist_externals = pytest | ||
| commands = | ||
| pytest --cov=json2xml --cov-report=xml:coverage/reports/coverage.xml --cov-report=term -xvs {posargs:tests} -n auto | ||
|
|
||
| [testenv:lint] | ||
| deps = | ||
| ruff>=0.3.0 | ||
| commands = | ||
| ruff check json2xml tests | ||
|
|
||
| [testenv:typecheck] | ||
| deps = | ||
| mypy>=1.0.0 | ||
| types-setuptools | ||
| commands = | ||
| pytest --cov --cov-report=xml | ||
| mypy json2xml tests | ||
|
|
||
| [testenv:py314-full] | ||
| deps = | ||
| {[testenv]deps} | ||
| commands = | ||
| {[testenv]commands} | ||
| ruff check json2xml tests | ||
| mypy json2xml tests | ||
|
|
||
| [pytest] | ||
| testpaths = tests | ||
| python_files = test_*.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (bug_risk): Consider pinning the action to a full semver or commit SHA
Loose tags (e.g.,
v6) can pull in unexpected patch updates that break builds. Pin to a full semver (e.g.,v6.2.1) or a commit SHA for reproducible workflows.