Skip to content

Commit 2e69e7f

Browse files
author
OptaxDev
committed
Merge pull request #746 from fabianp:pytest-tmp
PiperOrigin-RevId: 602343107
2 parents 904f989 + 00e5890 commit 2e69e7f

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

test.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +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}"
20+
rm -rf _testing
21+
mkdir -p _testing
22+
readonly VENV_DIR="$(mktemp -d -p `pwd`/_testing optax-env.XXXXXXXX)"
23+
# in the unlikely case in which there was something in that directory
2224
python3 -m venv "${VENV_DIR}"
2325
source "${VENV_DIR}/bin/activate"
2426
python --version
@@ -65,11 +67,11 @@ pip install optax*.whl
6567

6668
# Check types with pytype.
6769
pip install pytype
68-
pytype `find optax/_src/ examples optax/contrib -name '*.py' | xargs` -k -d import-error
70+
pytype `find optax/_src examples optax/contrib -name '*.py' | xargs` -k -d import-error
6971

7072
# Run tests using pytest.
7173
# Change directory to avoid importing the package from repo root.
72-
mkdir _testing && cd _testing
74+
cd _testing
7375
python -m pytest -n auto --pyargs optax
7476
cd ..
7577

0 commit comments

Comments
 (0)