Skip to content

Commit 1d886d6

Browse files
authored
remove dependency on pyproject.toml (#8)
1 parent ee515f5 commit 1d886d6

File tree

4 files changed

+7
-24
lines changed

4 files changed

+7
-24
lines changed

CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
## [Unreleased]
44

5-
## [v1.0.4] - 2022-12-23
5+
## [v1.0.5] - 2022-12-23
66

77
### Fixed
88

9-
- Fix incorrect toml package name for Python 3.10 and earlier
9+
- Remove dependency on presence of `pyproject.toml` file
1010

1111
## [v1.0.0] - 2022-12-23
1212

@@ -22,4 +22,4 @@
2222

2323
[//]: # "Release links"
2424
[v1.0.0]: https://github.com/jdkandersson/flake8-test-docs/releases/v1.0.0
25-
[v1.0.4]: https://github.com/jdkandersson/flake8-test-docs/releases/v1.0.4
25+
[v1.0.5]: https://github.com/jdkandersson/flake8-test-docs/releases/v1.0.5

flake8_test_docs.py

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,13 @@
33
import argparse
44
import ast
55
import re
6-
import sys
76
from functools import wraps
87
from pathlib import Path
98
from typing import Callable, Iterable, List, NamedTuple, Optional, Tuple, Type
109

1110
from flake8.options.manager import OptionManager
1211

13-
# One or the other line can't be covered depending on the Python version
14-
if sys.version_info < (3, 11): # pragma: nocover
15-
import tomli as tomllib
16-
else: # pragma: nocover
17-
import tomllib
18-
19-
ERROR_CODE_PREFIX = next(
20-
iter(
21-
tomllib.loads(Path("pyproject.toml").read_text(encoding="utf-8"))["tool"]["poetry"][
22-
"plugins"
23-
]["flake8.extension"].keys()
24-
)
25-
)
12+
ERROR_CODE_PREFIX = "TDO"
2613
MORE_INFO_BASE = "more information: https://github.com/jdkandersson/flake8-test-docs"
2714
MISSING_CODE = f"{ERROR_CODE_PREFIX}001"
2815
MISSING_MSG = (
@@ -369,9 +356,6 @@ class Plugin:
369356
"""
370357

371358
name = __name__
372-
version = tomllib.loads(Path("pyproject.toml").read_text(encoding="utf-8"))["tool"]["poetry"][
373-
"version"
374-
]
375359
_test_docs_pattern: DocsPattern = DocsPattern(*TEST_DOCS_PATTERN_DEFAULT.split("/"))
376360
_test_docs_filename_pattern: str = TEST_DOCS_FILENAME_PATTERN_DEFAULT
377361
_test_docs_function_pattern: str = TEST_DOCS_FUNCTION_PATTERN_DEFAULT

poetry.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "flake8-test-docs"
3-
version = "1.0.4"
3+
version = "1.0.5"
44
description = "A linter that checks test docstrings for the arrange/act/assert structure"
55
authors = ["David Andersson <david@jdkandersson.com>"]
66
license = "Apache 2.0"
@@ -22,7 +22,6 @@ classifiers = [
2222
[tool.poetry.dependencies]
2323
python = "^3.8.1"
2424
flake8 = "^6"
25-
tomli = { version = "^2", python = "<3.11" }
2625

2726
[tool.poetry.group.dev.dependencies]
2827
pytest = "^7"

0 commit comments

Comments
 (0)