Skip to content

Commit

Permalink
hacky script to help separate tests with dev dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
stringertheory committed Feb 6, 2024
1 parent bdec3ca commit 4b7342b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .check_external_deps.sh
@@ -0,0 +1,14 @@
#!/bin/sh

# write all imports that are in non-external-named test files
grep "import " tests/*.py | grep -v "external" > .test_external_deps_imports
# ls tests/*.py | grep -v external | xargs cat | grep "import " | sort | uniq > .test_external_deps_imports

# # go through every value in this and grep
> .test_external_deps_overlap
for i in `poetry show -T --only dev | tr '-' '_' | awk '{print $1}'`; do
grep $i .test_external_deps_imports >> .test_external_deps_overlap
done;

cat .test_external_deps_overlap | grep -v "\bpytest\b" | sort | uniq
rm -f .test_external_deps_imports .test_external_deps_overlap
2 changes: 2 additions & 0 deletions Makefile
Expand Up @@ -15,6 +15,8 @@ check: ## Run code quality tools.
# @poetry run mypy
# @echo "🚀 Checking for obsolete dependencies: Running deptry"
# @poetry run deptry traces
@echo "🚀 Check if using dev dependencies outside of tests marked external"
@./.check_external_deps.sh

.PHONY: test
test: ## Test the code with pytest
Expand Down

0 comments on commit 4b7342b

Please sign in to comment.