Skip to content

Commit

Permalink
Add integration tests for [tool.maturin.include] and `[tool.maturin…
Browse files Browse the repository at this point in the history
….exclude]`
  • Loading branch information
mbrobbel committed Nov 8, 2022
1 parent 5f8cc64 commit d71797e
Show file tree
Hide file tree
Showing 16 changed files with 462 additions and 0 deletions.
1 change: 1 addition & 0 deletions test-crates/pyo3-mixed-include-exclude/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include_this_file
289 changes: 289 additions & 0 deletions test-crates/pyo3-mixed-include-exclude/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions test-crates/pyo3-mixed-include-exclude/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[package]
authors = []
name = "pyo3-mixed-include-exclude"
version = "2.1.3"
description = "Implements a dummy function combining rust and python"
edition = "2021"

[dependencies]
pyo3 = { version = "0.17.3", features = [
"extension-module",
"generate-import-lib",
] }

[lib]
name = "pyo3_mixed"
crate-type = ["cdylib"]
30 changes: 30 additions & 0 deletions test-crates/pyo3-mixed-include-exclude/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# pyo3-mixed-include-exclude

A package for testing maturin with a mixed pyo3/python project with include and exclude configurations.

## Usage

```bash
pip install .
```

```python
import pyo3_mixed_include_exclude
assert pyo3_mixed_include_exclude.get_42() == 42
```

## Testing

Install tox:

```bash
pip install tox
```

Run it:

```bash
tox
```

The tests are in `test_pyo3_mixed_include_exclude.py`, while the configuration is in tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env python3

from boltons.strutils import slugify
import pyo3_mixed_include_exclude

assert pyo3_mixed_include_exclude.get_42() == 42
assert slugify("First post! Hi!!!!~1 ") == "first_post_hi_1"

print("SUCCESS")
Empty file.
Empty file.
6 changes: 6 additions & 0 deletions test-crates/pyo3-mixed-include-exclude/pyo3-config.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
implementation=CPython
version=3.10
shared=true
abi3=false
suppress_build_script_link_lines=false
pointer_width=64
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from .python_module.double import double
from .pyo3_mixed_include_exclude import get_21


def get_42() -> int:
return double(get_21)
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from typing import Callable


def double(fn: Callable[[], int]) -> int:
return 2 * fn()
16 changes: 16 additions & 0 deletions test-crates/pyo3-mixed-include-exclude/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[build-system]
requires = ["maturin>=0.13,<0.14"]
build-backend = "maturin"

[project]
name = "pyo3-mixed-include-exclude"
classifiers = ["Programming Language :: Python", "Programming Language :: Rust"]
requires-python = ">=3.7"
dependencies = ["boltons"]

[project.scripts]
get_42 = "pyo3_mixed:get_42"

[tool.maturin]
include = ["include_this_file", "missing"]
exclude = ["exclude_this_file", "tests/**/*", ".gitignore", "unused"]
Loading

0 comments on commit d71797e

Please sign in to comment.