diff --git a/Makefile.local b/Makefile.local new file mode 100644 index 00000000..5c7e3a5b --- /dev/null +++ b/Makefile.local @@ -0,0 +1,7 @@ +# run only tests that do not require database setup +test-nodb: + $(NOSE) $(NOSEFLAGS) -a '!db' + +# run only tests that do require database setup +test-db: + $(NOSE) $(NOSEFLAGS) -a 'db' diff --git a/README.db_testing b/README.db_testing new file mode 100644 index 00000000..01701ce3 --- /dev/null +++ b/README.db_testing @@ -0,0 +1,17 @@ +Running database-related tests +============================== + +Python tests for this module include tests that cannot be run without a local +Postgres database. You are not obliged to run those tests though: + +- `make test`: will run all tests +- `make test-nodb`: will run only tests that do not need a local DB +- `make test-db`: will run only tests that do need a local DB + +If you do want to run DB-related tests, you should: + +- ensure that your user is authorized to create and drop DBs, and in particular + DBs named "softwareheritage-test" and "softwareheritage-dev" + +- run `make -C sql/ dumpdb` from the top-level dir of this module to ensure you + have the local dump that is loaded for testing purposes