Skip to content

Commit

Permalink
Move Pytest settings to pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
vnmabus committed Jan 22, 2024
1 parent f23570b commit e99dd49
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 27 deletions.
41 changes: 23 additions & 18 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,26 @@ repository = "https://github.com/vnmabus/rdata"
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[tool.setuptools.packages.find]
include = ["rdata*"]
[tool.mypy]
strict = true
strict_equality = true
implicit_reexport = true

[tool.setuptools.dynamic]
version = {attr = "rdata.__version__"}
[[tool.mypy.overrides]]
module = [
"igraph.*",
"ipywidgets.*",
]
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "examples.*"
disallow_untyped_defs = false

[tool.pytest.ini_options]
addopts = "--doctest-modules --doctest-glob='*.rst'"
doctest_optionflags = "NORMALIZE_WHITESPACE ELLIPSIS"
norecursedirs = ".* build dist *.egg venv .svn _build docs/auto_examples examples"

[tool.ruff.lint]
select = [
Expand Down Expand Up @@ -116,18 +131,8 @@ convention = "google"
[tool.ruff.lint.pylint]
max-args = 7

[tool.mypy]
strict = true
strict_equality = true
implicit_reexport = true

[[tool.mypy.overrides]]
module = [
"igraph.*",
"ipywidgets.*",
]
ignore_missing_imports = true
[tool.setuptools.packages.find]
include = ["rdata*"]

[[tool.mypy.overrides]]
module = "examples.*"
disallow_untyped_defs = false
[tool.setuptools.dynamic]
version = {attr = "rdata.__version__"}
10 changes: 9 additions & 1 deletion rdata/tests/test_rdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import numpy as np
import pandas as pd
import pytest
import xarray

import rdata
Expand Down Expand Up @@ -234,6 +235,7 @@ def test_list(self) -> None:
],
})

@pytest.mark.filterwarnings("ignore:Missing constructor")
def test_file(self) -> None:
"""Test that external pointers can be parsed."""
parsed = rdata.parser.parse_file(TESTDATA_PATH / "test_file.rda")
Expand Down Expand Up @@ -288,6 +290,7 @@ def test_minimal_function_uncompiled(self) -> None:
"test_minimal_function_uncompiled <- function() NULL\n",
)

@pytest.mark.filterwarnings("ignore:Missing constructor")
def test_minimal_function(self) -> None:
"""Test that a minimal function (compiled) can be parsed."""
parsed = rdata.parser.parse_file(
Expand Down Expand Up @@ -342,6 +345,7 @@ def test_empty_function_uncompiled(self) -> None:
"test_empty_function_uncompiled <- function() {}\n",
)

@pytest.mark.filterwarnings("ignore:Missing constructor")
def test_empty_function(self) -> None:
"""Test that a simple function (compiled) can be parsed."""
parsed = rdata.parser.parse_file(
Expand Down Expand Up @@ -374,6 +378,7 @@ def test_empty_function(self) -> None:
"test_empty_function <- function() {}\n",
)

@pytest.mark.filterwarnings("ignore:Missing constructor")
def test_function(self) -> None:
"""Test that functions can be parsed."""
parsed = rdata.parser.parse_file(
Expand Down Expand Up @@ -409,6 +414,7 @@ def test_function(self) -> None:
"test_function <- function() {print(\"Hello\")}\n",
)

@pytest.mark.filterwarnings("ignore:Missing constructor")
def test_function_arg(self) -> None:
"""Test that functions can be parsed."""
parsed = rdata.parser.parse_file(
Expand Down Expand Up @@ -566,7 +572,9 @@ def test_ts(self) -> None:
def test_s4(self) -> None:
"""Test parsing of S4 classes."""
parsed = rdata.parser.parse_file(TESTDATA_PATH / "test_s4.rda")
converted = rdata.conversion.convert(parsed)

with pytest.warns(UserWarning, match="Missing constructor"):
converted = rdata.conversion.convert(parsed)

np.testing.assert_equal(converted, {
"test_s4": SimpleNamespace(
Expand Down
8 changes: 0 additions & 8 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
[aliases]
test=pytest

[tool:pytest]
addopts = --doctest-modules --doctest-glob="*.rst"
doctest_optionflags = NORMALIZE_WHITESPACE ELLIPSIS
norecursedirs = .* build dist *.egg venv .svn _build docs/auto_examples examples

[isort]
multi_line_output = 3
include_trailing_comma = true
Expand Down

0 comments on commit e99dd49

Please sign in to comment.