From 7d8e466e244822365419d3b531bb15643252300a Mon Sep 17 00:00:00 2001 From: blag Date: Tue, 17 Oct 2023 13:50:14 -0700 Subject: [PATCH] Add MaxMind database files to git so we don't need to constantly regenerate them --- .gitignore | 2 -- .pre-commit-config.yaml | 8 ++++++++ Makefile | 8 ++++++-- tests/test_city.mmdb | Bin 0 -> 2743 bytes tests/test_country.mmdb | Bin 0 -> 2457 bytes tox.ini | 2 -- 6 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 tests/test_city.mmdb create mode 100644 tests/test_country.mmdb diff --git a/.gitignore b/.gitignore index 800c70e..68a2f5f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,6 @@ /example/database.sqlite3 /example/GeoLiteCity.dat /django_user_sessions.egg-info/ -/tests/test_city.mmdb -/tests/test_country.mmdb /htmlcov/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ec76055..d037fce 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 diff --git a/Makefile b/Makefile index 5a87979..a4291dd 100644 --- a/Makefile +++ b/Makefile @@ -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} diff --git a/tests/test_city.mmdb b/tests/test_city.mmdb new file mode 100644 index 0000000000000000000000000000000000000000..9533ba8e6cb6a24ff7d0fa3fdc62f964810735ee GIT binary patch literal 2743 zcmZA12YA$U9LDiC1*wQAq5=Y9LWAYlKh`1k|854mB`3Stz_&YwI*+dZLkzKm(f~k zOWp$8;g;AQx5BNl18##Iaa-IDx5rM{8N1*P*cH2Bcia(s;7(}b&e#)o!Ci4T?1jB? zckF|GaS!Z={c!*e#6dV1hu~1$6ZgWsaTpHA5jYY@;Xb%8j>a)K7R#_4E3gvB;dq>Y z6ET5RSdBGUi<59NPQj@-4ePKTr{fIV4`<^3I16Xv0XPQ_#3ar|OFB<#kWP|P(m_(1 z-j2!wAz%%3d!V{fMc@Cai zJf!ob8)z<&E{w~Iq>H7iq)XyvF*BFqWq3JWflF{HUKts^x2y3QycVy+>m!RZH_B)w zEu+6l`c}GGdRMxI=2pB-dQG}rdQ!TB=1#l|@5X!ZUc3+Q#|Q91dC#vxMjHd3+%<+_Vy3lwKmdjITsSM_-M@>v4EPdNa;%NpCau zPO&MT^`7)T{Rj9Vek83Wtddp})f{44zM(;HZV|9S*tGnzJ7isAP^ z9B7MMU_0Cr+v8TaHFm&lup@4Z+u`=u2|HsK+yT2{H|&l(Vh`L2P23rK;x4!=?uNav zH}d^A`jGqL9@r22;{Y6pgK#ho!J)V(?uC2fFdU8}a3qex!du;!JQ~N~SS-VGtiVbf zhvRVq^8JsNAR(iQrW$Lo7AMKrU&dte6r76Funy~SI?llTa3&V+HguMZ*>Q6KVUCOg z<0eU%iJ`DU5h zXlHDHe6!~VR%W%?Yg+NlLcysue!d~?EO7krPJE;F8ne2hth}P|9Q9=lzL&`dwpniZ zPRgvvSiZk(<@#D{VXfn)2c*30=d&9e*UGgd=XtrT6(qCPd@q+=VCSOiEiL)~QOEt~ z=#uJ&ypu^M?Pf34)VjnTu;GN-v=vwlmTxD6mS($lg6-9WFLFr#ig2x})3%?=InB{4 zi&kTf>TN$T<1N6Mmv1M@YE_dd}ra3h3mK6$X4g< Ol$T251vR7t@RB zy<@6rCZ_ky{CCHgaOV8Zo%_Cdyy0;6tYpYoFQv!`OQ|wuN@?Uan2v3+oii)7CwIV( z*a3-Kbn7%y>kkGBh^`^fj>1Nb05id@iCH)iC*fqw z#wj=zr{Q#*fr&rtEb?regL82n&c_AF=fAO#oP)Wz2%X*XWGp7RfN?t)_6@NVJ%k4SVstWtBFlaZmThfA+)eYMlHb^ zu1f~zd&Is!t@%N_DH4x1?<@$%>_E^CSveJDc@eY0inZog5r0J_9JfNgvbY(yV%v7? z_M4mh;YcVeXgBPttPV%aXmg;(jy9O_K!dr#js`Yb(OB4yw50rhH5~bOb!%~TQ@B19 zuo~@PU0RBjwP%YzWX8>EGiC+i&5c%RzGasRdSZ_vZo6K4(W~4b!7e$;Gb>7x__3cKuIBEs$Xeba1 JZ?;-8{sG8MnVbLs literal 0 HcmV?d00001 diff --git a/tox.ini b/tox.ini index 191e76f..893502b 100644 --- a/tox.ini +++ b/tox.ini @@ -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 @@ -41,4 +40,3 @@ deps = geoip2 ignore_outcome = djmain: True -allowlist_externals = make