Skip to content

Commit a2cbd53

Browse files
committed
Install virtual environment in current directory instead of /tmp
This solves the issue of pytest 8.0.0 not being able to run tests from /tmp/ directory. See pytest-dev/pytest#11807
1 parent 904f989 commit a2cbd53

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

test.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@
1717
set -xeuo pipefail
1818

1919
# Install deps in a virtual env.
20-
readonly VENV_DIR=/tmp/optax-env
21-
rm -rf "${VENV_DIR}"
22-
python3 -m venv "${VENV_DIR}"
20+
mkdir -p _testing
21+
VENV_DIR="$(mktemp -d -p `pwd`/_testing optax-env.XXXXXXXX)"
22+
# in the unlikely case in which there was something in that directory
23+
python3 -m venv --copies "${VENV_DIR}"
2324
source "${VENV_DIR}/bin/activate"
2425
python --version
2526

@@ -63,13 +64,13 @@ python -m build
6364
pip wheel --verbose --no-deps --no-clean dist/optax*.tar.gz
6465
pip install optax*.whl
6566

66-
# Check types with pytype.
67+
# # Check types with pytype.
6768
pip install pytype
68-
pytype `find optax/_src/ examples optax/contrib -name '*.py' | xargs` -k -d import-error
69+
pytype `find optax/_src examples optax/contrib -name '*.py' | xargs` -k -d import-error
6970

7071
# Run tests using pytest.
7172
# Change directory to avoid importing the package from repo root.
72-
mkdir _testing && cd _testing
73+
cd _testing
7374
python -m pytest -n auto --pyargs optax
7475
cd ..
7576

0 commit comments

Comments
 (0)