Skip to content

include conftest.py in MANIFEST.in #451

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

Merged
merged 4 commits into from
May 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Rely on pre-commit.ci instead
name: Lint via pre-commit

on:
pull_request:
push:
branches-ignore:
- main
workflow_dispatch:
# pull_request:
# push:
# branches-ignore:
# - main

permissions:
contents: read
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ repos:
- id: black
- id: black-jupyter
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.264
rev: v0.0.265
hooks:
- id: ruff
args: [--fix-only, --show-fixes]
Expand Down Expand Up @@ -86,7 +86,7 @@ repos:
additional_dependencies: [tomli]
files: ^(graphblas|docs)/
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.264
rev: v0.0.265
hooks:
- id: ruff
- repo: https://github.com/sphinx-contrib/sphinx-lint
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ recursive-include graphblas *.py
prune docs
prune scripts
include setup.py
include conftest.py
include README.md
include LICENSE
include MANIFEST.in
Expand Down
17 changes: 11 additions & 6 deletions graphblas/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,31 @@

def pytest_configure(config):
rng = np.random.default_rng()
randomly = config.getoption("--randomly", False)
randomly = config.getoption("--randomly", None)
if randomly is None: # pragma: no cover
options_unavailable = True
randomly = True
config.addinivalue_line("markers", "slow: Skipped unless --runslow passed")
else:
options_unavailable = False
backend = config.getoption("--backend", None)
if backend is None:
if randomly:
backend = "suitesparse" if rng.random() < 0.5 else "suitesparse-vanilla"
else:
backend = "suitesparse"
blocking = config.getoption("--blocking", True)
blocking = config.getoption("--blocking", None)
if blocking is None: # pragma: no branch
blocking = rng.random() < 0.5 if randomly else True
record = config.getoption("--record", False)
if record is None: # pragma: no branch
record = rng.random() < 0.5 if randomly else False
mapnumpy = config.getoption("--mapnumpy", False)
mapnumpy = config.getoption("--mapnumpy", None)
if mapnumpy is None:
mapnumpy = rng.random() < 0.5 if randomly else False
runslow = config.getoption("--runslow", False)
runslow = config.getoption("--runslow", None)
if runslow is None:
# Add a small amount of randomization to be safer
runslow = rng.random() < 0.05 if randomly else False
runslow = options_unavailable
config.runslow = runslow

gb.config.set(autocompute=False, mapnumpy=mapnumpy)
Expand Down
5 changes: 4 additions & 1 deletion graphblas/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ def test_packages():
if not pyproject.exists(): # pragma: no cover (safety)
pytest.skip("Did not find pyproject.toml")
with pyproject.open("rb") as f:
pkgs2 = sorted(tomli.load(f)["tool"]["setuptools"]["packages"])
cfg = tomli.load(f)
if cfg.get("project", {}).get("name") != "python-graphblas": # pragma: no cover (safety)
pytest.skip("Did not find correct pyproject.toml")
pkgs2 = sorted(cfg["tool"]["setuptools"]["packages"])
assert (
pkgs == pkgs2
), "If there are extra items on the left, add them to pyproject.toml:tool.setuptools.packages"
2 changes: 1 addition & 1 deletion graphblas/tests/test_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def plus_one(x):
UnaryOp.register_new("bad", object())
assert not hasattr(unary, "bad")
with pytest.raises(UdfParseError, match="Unable to parse function using Numba"):
UnaryOp.register_new("bad", lambda x: v)
UnaryOp.register_new("bad", lambda x: v) # pragma: no branch (numba)


@pytest.mark.skipif("not supports_udfs")
Expand Down
4 changes: 2 additions & 2 deletions graphblas/tests/test_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ def inner(x, idx, _, thunk): # pragma: no cover (numba)
delattr(indexunary, "iin")
delattr(select, "iin")
with pytest.raises(UdfParseError, match="Unable to parse function using Numba"):
indexunary.register_new("bad", lambda x, row, col, thunk: result)
indexunary.register_new("bad", lambda x, row, col, thunk: result) # pragma: no branch


def test_reduce(v):
Expand Down Expand Up @@ -2425,7 +2425,7 @@ def test_lambda_udfs(v):
# with pytest.raises(TypeError):
v.ewise_add(v, lambda x, y: x + y) # pragma: no branch (numba)
with pytest.raises(TypeError):
v.inner(v, lambda x, y: x + y)
v.inner(v, lambda x, y: x + y) # pragma: no branch (numba)


def test_get(v):
Expand Down