Skip to content

Commit

Permalink
Merge pull request #105 from PetrDlouhy/github_testing
Browse files Browse the repository at this point in the history
GitHub testing
  • Loading branch information
areski authored Apr 22, 2024
2 parents 654b6df + 63c9c95 commit 04a802d
Show file tree
Hide file tree
Showing 8 changed files with 142 additions and 68 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Django CI

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
django-version: ['3.2.*', '4.0.*', '4.1.*', '4.2.*', '5.0.*']
exclude:
- django-version: '3.2.*'
python-version: '3.11'
- django-version: '3.2.*'
python-version: '3.12'

- django-version: '4.0.*'
python-version: '3.11'
- django-version: '4.0.*'
python-version: '3.12'

- django-version: '4.1.*'
python-version: '3.12'

- django-version: '5.0.*'
python-version: '3.8'
- django-version: '5.0.*'
python-version: '3.9'

steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
pip install setuptools
pip install Django==${{ matrix.django-version }}
python setup.py install
pip install -r test_requirements.txt
- name: Run tests
run: DJANGO_SETTINGS_MODULE=demoproject.demoproject.settings python setup.py test
14 changes: 0 additions & 14 deletions .travis.yml

This file was deleted.

39 changes: 31 additions & 8 deletions demoproject/demoproject/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import os

DEBUG = True
TEMPLATE_DEBUG = DEBUG

APPLICATION_DIR = os.path.dirname(globals()['__file__'])

Expand Down Expand Up @@ -97,11 +96,37 @@
SECRET_KEY = 'sq)9^f#mf444c(#om$zpo0v!%y=%pqem*9s_qav93fwr_&x40u'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
'django.template.loaders.eggs.Loader',
)
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [os.path.join(APPLICATION_DIR, "templates")],
"OPTIONS": {
"debug": DEBUG,
"loaders": [
(
"django.template.loaders.cached.Loader",
[
"django.template.loaders.filesystem.Loader",
"django.template.loaders.app_directories.Loader",
"admin_tools.template_loaders.Loader",
],
),
],
"context_processors": [
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
"django.template.context_processors.debug",
"django.template.context_processors.i18n",
"django.template.context_processors.media",
"django.template.context_processors.static",
"django.template.context_processors.csrf",
"django.template.context_processors.tz",
"django.template.context_processors.request",
],
},
}
]


MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
Expand All @@ -118,8 +143,6 @@
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'demoproject.wsgi.application'

TEMPLATE_DIRS = (os.path.join(APPLICATION_DIR, 'templates'), )

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
Expand Down
32 changes: 16 additions & 16 deletions demoproject/demoproject/urls.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
from django.conf.urls import url
from django.urls import path
from . import views


urlpatterns = [
url(r'^$', views.home, name='home'),
url(r'^piechart/', views.demo_piechart, name='demo_piechart'),
url(r'^linechart/', views.demo_linechart, name='demo_linechart'),
url(r'^linechart_without_date/', views.demo_linechart_without_date, name='demo_linechart_without_date'),
url(r'^linewithfocuschart/', views.demo_linewithfocuschart, name='demo_linewithfocuschart'),
url(r'^multibarchart/', views.demo_multibarchart, name='demo_multibarchart'),
url(r'^stackedareachart/', views.demo_stackedareachart, name='demo_stackedareachart'),
url(r'^multibarhorizontalchart/', views.demo_multibarhorizontalchart, name='demo_multibarhorizontalchart'),
url(r'^lineplusbarchart/', views.demo_lineplusbarchart, name='demo_lineplusbarchart'),
url(r'^cumulativelinechart/', views.demo_cumulativelinechart, name='demo_cumulativelinechart'),
url(r'^discretebarchart/', views.demo_discretebarchart, name='demo_discretebarchart'),
url(r'^discretebarchart_with_date/', views.demo_discretebarchart_with_date, name='demo_discretebarchart_date'),
url(r'^scatterchart/', views.demo_scatterchart, name='demo_scatterchart'),
url(r'^linechart_with_ampm/', views.demo_linechart_with_ampm, name='demo_linechart_with_ampm'),
# url(r'^demoproject/', include('demoproject.foo.urls')),
path('', views.home, name='home'),
path('piechart/', views.demo_piechart, name='demo_piechart'),
path('linechart/', views.demo_linechart, name='demo_linechart'),
path('linechart_without_date/', views.demo_linechart_without_date, name='demo_linechart_without_date'),
path('linewithfocuschart/', views.demo_linewithfocuschart, name='demo_linewithfocuschart'),
path('multibarchart/', views.demo_multibarchart, name='demo_multibarchart'),
path('stackedareachart/', views.demo_stackedareachart, name='demo_stackedareachart'),
path('multibarhorizontalchart/', views.demo_multibarhorizontalchart, name='demo_multibarhorizontalchart'),
path('lineplusbarchart/', views.demo_lineplusbarchart, name='demo_lineplusbarchart'),
path('cumulativelinechart/', views.demo_cumulativelinechart, name='demo_cumulativelinechart'),
path('discretebarchart/', views.demo_discretebarchart, name='demo_discretebarchart'),
path('discretebarchart_with_date/', views.demo_discretebarchart_with_date, name='demo_discretebarchart_date'),
path('scatterchart/', views.demo_scatterchart, name='demo_scatterchart'),
path('linechart_with_ampm/', views.demo_linechart_with_ampm, name='demo_linechart_with_ampm'),
# path('^demoproject/', include('demoproject.foo.urls')),
]
30 changes: 15 additions & 15 deletions demoproject/demoproject/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

from django.shortcuts import render_to_response
from django.shortcuts import render
import random
import datetime
import time
Expand All @@ -10,7 +10,7 @@ def home(request):
"""
home page
"""
return render_to_response('home.html')
return render(request, 'home.html')


def demo_piechart(request):
Expand Down Expand Up @@ -42,7 +42,7 @@ def demo_piechart(request):
'jquery_on_ready': False,
}
}
return render_to_response('piechart.html', data)
return render(request, 'piechart.html', data)


def demo_linechart(request):
Expand Down Expand Up @@ -83,7 +83,7 @@ def demo_linechart(request):
'jquery_on_ready': False,
}
}
return render_to_response('linechart.html', data)
return render('linechart.html', data)


def demo_linechart_without_date(request):
Expand All @@ -110,7 +110,7 @@ def demo_linechart_without_date(request):
'jquery_on_ready': False,
}
}
return render_to_response('linechart.html', data)
return render(request, 'linechart.html', data)


def demo_linewithfocuschart(request):
Expand Down Expand Up @@ -151,7 +151,7 @@ def demo_linewithfocuschart(request):
'jquery_on_ready': True,
}
}
return render_to_response('linewithfocuschart.html', data)
return render(request, 'linewithfocuschart.html', data)


def demo_multibarchart(request):
Expand Down Expand Up @@ -215,7 +215,7 @@ def demo_multibarchart(request):
'jquery_on_ready': True,
},
}
return render_to_response('multibarchart.html', data)
return render(request, 'multibarchart.html', data)


def demo_stackedareachart(request):
Expand Down Expand Up @@ -249,7 +249,7 @@ def demo_stackedareachart(request):
'jquery_on_ready': True,
},
}
return render_to_response('stackedareachart.html', data)
return render(request, 'stackedareachart.html', data)


def demo_multibarhorizontalchart(request):
Expand Down Expand Up @@ -282,7 +282,7 @@ def demo_multibarhorizontalchart(request):
'jquery_on_ready': True,
},
}
return render_to_response('multibarhorizontalchart.html', data)
return render(request, 'multibarhorizontalchart.html', data)


def demo_lineplusbarchart(request):
Expand Down Expand Up @@ -324,7 +324,7 @@ def demo_lineplusbarchart(request):
'focus_enable': True,
},
}
return render_to_response('lineplusbarchart.html', data)
return render(request, 'lineplusbarchart.html', data)


def demo_cumulativelinechart(request):
Expand Down Expand Up @@ -363,7 +363,7 @@ def demo_cumulativelinechart(request):
'jquery_on_ready': True,
},
}
return render_to_response('cumulativelinechart.html', data)
return render(request, 'cumulativelinechart.html', data)


def demo_discretebarchart(request):
Expand All @@ -390,7 +390,7 @@ def demo_discretebarchart(request):
'jquery_on_ready': True,
},
}
return render_to_response('discretebarchart.html', data)
return render(request, 'discretebarchart.html', data)


def demo_discretebarchart_with_date(request):
Expand Down Expand Up @@ -421,7 +421,7 @@ def demo_discretebarchart_with_date(request):
'jquery_on_ready': True,
},
}
return render_to_response('discretebarchart_with_date.html', data)
return render(request, 'discretebarchart_with_date.html', data)


def demo_scatterchart(request):
Expand Down Expand Up @@ -459,7 +459,7 @@ def demo_scatterchart(request):
'jquery_on_ready': True,
},
}
return render_to_response('scatterchart.html', data)
return render(request, 'scatterchart.html', data)


def demo_linechart_with_ampm(request):
Expand Down Expand Up @@ -494,4 +494,4 @@ def demo_linechart_with_ampm(request):
'jquery_on_ready': True,
}
}
return render_to_response('linechart_with_ampm.html', data)
return render(request, 'linechart_with_ampm.html', data)
43 changes: 30 additions & 13 deletions nvd3_tests/testproject/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import os

DEBUG = True
TEMPLATE_DEBUG = DEBUG

APPLICATION_DIR = os.path.dirname(globals()['__file__'])

Expand Down Expand Up @@ -90,11 +89,36 @@
SECRET_KEY = 'sq)9^f#mf444c(#om$zpo0v!%y=%pqem*9s_qav93fwr_&x40u'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
'django.template.loaders.eggs.Loader',
)
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [os.path.join(APPLICATION_DIR, "templates")],
"OPTIONS": {
"debug": DEBUG,
"loaders": [
(
"django.template.loaders.cached.Loader",
[
"django.template.loaders.filesystem.Loader",
"django.template.loaders.app_directories.Loader",
"admin_tools.template_loaders.Loader",
],
),
],
"context_processors": [
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
"django.template.context_processors.debug",
"django.template.context_processors.i18n",
"django.template.context_processors.media",
"django.template.context_processors.static",
"django.template.context_processors.csrf",
"django.template.context_processors.tz",
"django.template.context_processors.request",
],
},
}
]

MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
Expand All @@ -111,13 +135,6 @@
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'demoproject.wsgi.application'

TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
os.path.join(APPLICATION_DIR, 'templates')
)

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
Expand Down
1 change: 1 addition & 0 deletions test_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Django
Django-bower
2 changes: 0 additions & 2 deletions tests/test_template_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
Context,
Template
)
from django.conf import settings
settings.configure()
django.setup()
from django.test.utils import override_settings
try:
Expand Down

0 comments on commit 04a802d

Please sign in to comment.