Allow running Rust tests with ts
- ID
5bf47d9- date
2024-06-18 09:29:00+00:00- author
Alex Chan <alex@alexwlchan.net>- parent
e5d1ce4- message
Allow running Rust tests with `ts`- changed files
1 file, 21 additions, 6 deletions
Changed files
flickr/ts (194) → flickr/ts (402)
diff --git a/flickr/ts b/flickr/ts
index b601de3..d8ef092 100755
--- a/flickr/ts
+++ b/flickr/ts
@@ -3,12 +3,27 @@
set -o errexit
set -o nounset
-export FLICKR_API_KEY=$(keyring get flickr_api key)
+function run_python_tests() {
+ export FLICKR_API_KEY=$(keyring get flickr_api key)
-ruff check .
-ruff format .
+ ruff check .
+ ruff format .
-mypy src tests
+ mypy src tests
-coverage run -m pytest tests
-coverage report
+ coverage run -m pytest tests
+ coverage report
+}
+
+function run_rust_tests() {
+ cargo fmt
+ cargo build
+ cargo test
+}
+
+if test -f Cargo.toml
+then
+ run_rust_tests
+else
+ run_python_tests
+fi