-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Remove dev dependency on pytest and use backports.strenum only…
… on < 3.11 (#18)
- Loading branch information
1 parent
90eba6b
commit 809a03a
Showing
5 changed files
with
66 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ keywords = [ | |
"http", | ||
"httpmethod", | ||
] | ||
license = "MIT" | ||
license.file = "LICENSE" | ||
authors = [ | ||
{ name = "Edgar Ramírez-Mondragón", email = "[email protected]" }, | ||
] | ||
|
@@ -30,21 +30,15 @@ classifiers = [ | |
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
"Programming Language :: Python :: 3.13", | ||
"Programming Language :: Python :: Implementation :: CPython", | ||
"Programming Language :: Python :: Implementation :: PyPy", | ||
] | ||
dynamic = [ | ||
"version", | ||
] | ||
dependencies = [ | ||
"backports.strenum", | ||
] | ||
optional-dependencies.dev = [ | ||
"backports.httpmethod[test]", | ||
] | ||
optional-dependencies.test = [ | ||
"coverage[toml]", | ||
"pytest", | ||
'backports.strenum; python_version < "3.11"', | ||
] | ||
urls.Documentation = "https://github.com/edgarrmondragon/backports.httpmethod#readme" | ||
urls.Issues = "https://github.com/edgarrmondragon/backports.httpmethod/issues" | ||
|
@@ -56,18 +50,16 @@ packages = ["src/backports"] | |
[tool.hatch.version] | ||
source = "vcs" | ||
|
||
[tool.hatch.envs.test] | ||
features = ["test"] | ||
[tool.hatch.envs.test.overrides] | ||
[tool.hatch.envs.default] | ||
[tool.hatch.envs.default.overrides] | ||
env.GITHUB_ACTIONS.dev-mode = { value = false, if = ["true"] } | ||
matrix.python.env-vars = [ | ||
{ key = "COVERAGE_CORE", value = "sysmon", if = ["3.12", "3.13"] } | ||
] | ||
[tool.hatch.envs.test.scripts] | ||
test = "pytest {args:tests}" | ||
cov = "coverage run -m pytest {args:tests}" | ||
[tool.hatch.envs.default.scripts] | ||
test = "python -Im unittest {args}" | ||
|
||
[[tool.hatch.envs.test.matrix]] | ||
[[tool.hatch.envs.all.matrix]] | ||
python = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] | ||
|
||
[tool.hatch.envs.lint] | ||
|
@@ -93,6 +85,7 @@ all = [ | |
|
||
[tool.ruff] | ||
line-length = 120 | ||
preview = true | ||
target-version = "py37" | ||
|
||
[tool.ruff.lint] | ||
|
@@ -148,8 +141,13 @@ known-first-party = ["backports_httpmethod"] | |
ban-relative-imports = "all" | ||
|
||
[tool.ruff.lint.per-file-ignores] | ||
# Tests can use magic values, assertions, and relative imports | ||
"tests/**/*" = ["PLR2004", "S101", "TID252"] | ||
# Tests can use magic values, and relative imports | ||
"tests/**/*" = ["PLR2004", "TID252"] | ||
|
||
[tool.pyproject-fmt] | ||
indent = 2 | ||
keep_full_version = true | ||
max_supported_python = "3.13" | ||
|
||
[tool.coverage.run] | ||
source_pkgs = ["backports", "tests"] | ||
|
@@ -161,7 +159,7 @@ backports_httpmethod = ["src/backports/httpmethod", "*/backports.httpmethod/src/ | |
tests = ["tests", "*/backports.httpmethod/tests"] | ||
|
||
[tool.coverage.report] | ||
exclude_lines = [ | ||
exclude_also = [ | ||
"no cov", | ||
"if __name__ == .__main__.:", | ||
"if TYPE_CHECKING:", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,37 @@ | ||
from backports.httpmethod import HTTPMethod | ||
|
||
|
||
def test_equals_string(): | ||
assert HTTPMethod.GET == "GET" | ||
|
||
import sys | ||
import unittest | ||
|
||
def test_value(): | ||
assert HTTPMethod.GET.value == "GET" | ||
|
||
|
||
def test_description(): | ||
assert HTTPMethod.GET.description == "Retrieve the target." | ||
from backports.httpmethod import HTTPMethod | ||
|
||
|
||
def test_available_methods(): | ||
assert list(HTTPMethod) == [ | ||
HTTPMethod.CONNECT, | ||
HTTPMethod.DELETE, | ||
HTTPMethod.GET, | ||
HTTPMethod.HEAD, | ||
HTTPMethod.OPTIONS, | ||
HTTPMethod.PATCH, | ||
HTTPMethod.POST, | ||
HTTPMethod.PUT, | ||
HTTPMethod.TRACE, | ||
] | ||
class TestHTTPMethod(unittest.TestCase): | ||
def test_equals_string(self): | ||
self.assertEqual(HTTPMethod.GET, "GET") | ||
|
||
def test_value(self): | ||
self.assertEqual(HTTPMethod.GET.value, "GET") | ||
|
||
def test_description(self): | ||
self.assertEqual(HTTPMethod.GET.description, "Retrieve the target.") | ||
|
||
def test_available_methods(self): | ||
self.assertListEqual( | ||
list(HTTPMethod), | ||
[ | ||
HTTPMethod.CONNECT, | ||
HTTPMethod.DELETE, | ||
HTTPMethod.GET, | ||
HTTPMethod.HEAD, | ||
HTTPMethod.OPTIONS, | ||
HTTPMethod.PATCH, | ||
HTTPMethod.POST, | ||
HTTPMethod.PUT, | ||
HTTPMethod.TRACE, | ||
], | ||
) | ||
|
||
@unittest.skipIf(sys.version_info < (3, 11), "requires Python 3.11+") | ||
def test_equality(self): | ||
from http import HTTPMethod as PyHTTPMethod # noqa: PLC0415 | ||
|
||
self.assertEqual(HTTPMethod.__members__, PyHTTPMethod.__members__) |