Debian Codegraph @

test-crates/lib_with_path_dep/test.sh

raw
1 #!/bin/bash
2
3 set -ex
4
5 # The problem with testing this is that we need to go through the PEP 517 so we need a wheel of maturin,
6 # which makes everything complex and slow
7 cd "$(git rev-parse --show-toplevel)" # Go to project root
8
9 pip uninstall -y lib_with_path_dep 2> /dev/null
10 # Make sure it's actually removed
11 python -c "from lib_with_path_dep import add; assert add(2,2)==4" 2> /dev/null && exit 1 || true
12
13 # Build maturin wheel
14 cargo run -- build -b bin --strip --manylinux off
15 cargo run -- pep517 write-sdist --manifest-path test-crates/lib_with_path_dep/Cargo.toml --sdist-directory test-crates/lib_with_path_dep/target/wheels
16 # Slower alternative: cargo run -- build -m test-crates/lib_with_path_dep/Cargo.toml -i python
17 # See https://github.com/pypa/pip/issues/6041
18
19 # First, use the maturin wheel we just build
20 # Then install lib_with_path_dep from the sdist we build
21 pip install \
22 --find-links target/wheels/ \
23 --force-reinstall --no-binary lib_with_path_dep --find-links test-crates/lib_with_path_dep/target/wheels lib_with_path_dep
24 python -c "from lib_with_path_dep import add; assert add(2,2)==4"