Skip to content
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

Add basic testing automation against all version of Python using nox #2536

Merged
merged 10 commits into from
Jun 30, 2023
Merged
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ screenshot*.png

# Web demo app build
web_demo

.nox/
17 changes: 17 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from __future__ import annotations
abey79 marked this conversation as resolved.
Show resolved Hide resolved

import nox # type: ignore


@nox.session(python=["3.8", "3.9", "3.10", "3.11"])
def tests(session: nox.Session) -> None:
session.install("-r", "rerun_py/requirements-build.txt")
session.install("./rerun_py")
session.run("just", "py-test")


@nox.session(python=["3.8", "3.9", "3.10", "3.11"])
def examples(session: nox.Session) -> None:
session.install("-r", "examples/python/requirements.txt")
session.install("./rerun_py")
session.run("python", "scripts/run_all.py", "--save")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could this file be moved to e.g. scripts/ so as not to pollute the repo root further?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but that would mean running nox -f scripts/noxfile.py -s tests. I guess that can be hidden behind just nox -s tests. Prefer that way?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just looked into it, and I'm a bit split. It's not tooo bad to move it and force using just nox ..., but does generate some friction wrt usual nox expectations, incl:

  • one must change the current directory to .. in each session function
  • the .nox cache dir weirdly ends up in scripts/ as well

Also, I believe nox could help with #2200, so I'm inclined to give it first-class citizen status.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok!

5 changes: 4 additions & 1 deletion scripts/setup_dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ cargo install taplo-cli --locked # toml formatter/linter/lsp
cargo install typos-cli


packagesNeeded='pngcrush'
packagesNeeded='pngcrush pipx'
if [ -x "$(command -v brew)" ]; then brew install $packagesNeeded
elif [ -x "$(command -v port)" ]; then sudo port install $packagesNeeded
elif [ -x "$(command -v apt-get)" ]; then sudo apt-get -y install $packagesNeeded
Expand All @@ -29,4 +29,7 @@ else
exit 1
fi

# install nox for python testing automation
pipx install nox

echo "setup_dev.sh completed!"
Loading