Skip to content

Commit

Permalink
Add MaxMind database files to git so we don't need to constantly rege…
Browse files Browse the repository at this point in the history
…nerate them
  • Loading branch information
blag committed Oct 17, 2023
1 parent eb315b2 commit 7d8e466
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 6 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/example/database.sqlite3
/example/GeoLiteCity.dat
/django_user_sessions.egg-info/
/tests/test_city.mmdb
/tests/test_country.mmdb

/htmlcov/

Expand Down
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,11 @@ repos:
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: local
hooks:
- id: generate-mmdb-fixtures
name: Regenerate MaxMind database files
language: system
entry: make tests/test_city.mmdb tests/test_country.mmdb
always_run: true
pass_filenames: false
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@ check:
DJANGO_SETTINGS_MODULE=example.settings PYTHONPATH=. \
python -Wd example/manage.py check

generate-mmdb-fixtures:
tests/test_city.mmdb: tests/Dockerfile tests/generate_mmdb.pl
docker --context=default buildx build -f tests/Dockerfile --tag test-mmdb-maker tests
docker run --rm --volume $$(pwd)/tests:/data test-mmdb-maker

test: generate-mmdb-fixtures
tests/test_country.mmdb: tests/Dockerfile tests/generate_mmdb.pl
docker --context=default buildx build -f tests/Dockerfile --tag test-mmdb-maker tests
docker run --rm --volume $$(pwd)/tests:/data test-mmdb-maker

test: tests/test_city.mmdb tests/test_country.mmdb
DJANGO_SETTINGS_MODULE=tests.settings PYTHONPATH=. \
django-admin.py test ${TARGET}

Expand Down
Binary file added tests/test_city.mmdb
Binary file not shown.
Binary file added tests/test_country.mmdb
Binary file not shown.
2 changes: 0 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ DJANGO =

[testenv]
commands =
make generate-mmdb-fixtures
coverage run {envbindir}/django-admin test -v 2 --pythonpath=./ --settings=tests.settings
coverage report
coverage xml
Expand All @@ -41,4 +40,3 @@ deps =
geoip2
ignore_outcome =
djmain: True
allowlist_externals = make

0 comments on commit 7d8e466

Please sign in to comment.