1
Fork 0

test with `nix build <...>`

This commit is contained in:
Motiejus Jakštys 2024-01-13 18:36:51 +02:00
parent e81eb6c6d2
commit 0a5abf6652
3 changed files with 22 additions and 6 deletions

7
Makefile Normal file
View File

@ -0,0 +1,7 @@
.PHONY: check
test:
nix build .#e11sync-gunicorn.tests.simple -L
.PHONY: gunicorn
gunicorn:
nix run .#e11sync-gunicorn

View File

@ -17,9 +17,11 @@ Including another URLconf
from django.contrib import admin from django.contrib import admin
from django.urls import include, path from django.urls import include, path
from django.conf import settings
urlpatterns = [ urlpatterns = [
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
path("__debug__/", include("debug_toolbar.urls")), ] + [
path("__debug__/", include("debug_toolbar.urls"))] if settings.DEBUG else [] + [
path('', include('signup.urls')), path('', include('signup.urls')),
] ]

View File

@ -88,13 +88,20 @@
--set E11SYNC_DEBUG "" \ --set E11SYNC_DEBUG "" \
--set E11SYNC_COMPRESS_OFFLINE 1 \ --set E11SYNC_COMPRESS_OFFLINE 1 \
--set GEOIP_PATH "${geoip}" \ --set GEOIP_PATH "${geoip}" \
--add-flags e11sync.wsgi \ --add-flags --bind=127.0.0.1:${toString gunicornPort} \
--add-flags --bind=127.0.0.1:${toString gunicornPort} --add-flags e11sync.wsgi
''; '';
passthru.tests = { passthru.tests = {
simple = pkgs.runCommand {} "e11sync-test" '' simple =
exit 1; pkgs.runCommand "e11sync-test" {
''; src = self;
buildInputs = runtimeDeps ++ buildDeps;
} ''
mkdir -p $out
cd ${self}/app
export GEOIP_PATH="${geoip}"
${pkgs.python3}/bin/python3 ./manage.py test
'';
}; };
}; };