From 864d45abe5ec985836baf52de168943d25a03be6 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Wed, 6 Mar 2019 23:10:40 +0100 Subject: [PATCH] More housekeeping: remove nose and unused cruft. --- .gitignore | 1 - Makefile | 18 ++++++++++++ hudson_build.sh | 6 ---- logging.cfg | 29 ------------------- logging.cfg.dev | 29 ------------------- requirements-test.txt | 5 ---- requirements/requirements-dev.txt | 1 + requirements/requirements-test.txt | 3 ++ .../requirements.txt | 0 src/catalogue/tests/test_gallery.py | 1 - src/cover/tests.py | 1 - src/dvcs/tests/tests.py | 2 -- src/redakcja/settings/__init__.py | 6 ++-- src/redakcja/settings/defaults.py | 2 ++ src/redakcja/settings/test.py | 4 --- src/wiki_img/tests.py | 5 ++-- 16 files changed, 29 insertions(+), 84 deletions(-) create mode 100644 Makefile delete mode 100644 hudson_build.sh delete mode 100644 logging.cfg delete mode 100644 logging.cfg.dev delete mode 100644 requirements-test.txt create mode 100644 requirements/requirements-dev.txt create mode 100644 requirements/requirements-test.txt rename requirements.txt => requirements/requirements.txt (100%) diff --git a/.gitignore b/.gitignore index 26e48d32..ee2673ee 100644 --- a/.gitignore +++ b/.gitignore @@ -13,7 +13,6 @@ var .coverage .coveragerc coverage.xml -nosetests.xml pip-log.txt /htmlcov diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..304f5db7 --- /dev/null +++ b/Makefile @@ -0,0 +1,18 @@ +.PHONY: deploy test + + +deploy: src/redakcja/localsettings.py + pip install -r requirements/requirements.txt + src/manage.py migrate --noinput + src/manage.py collectstatic --noinput + + +.ONESHELL: +test: + cd src + coverage run --branch --source='.' ./manage.py test --settings=redakcja.settings.test; true + coverage html -d ../htmlcov.new + rm -rf ../htmlcov + mv ../htmlcov.new ../htmlcov + coverage report + rm .coverage diff --git a/hudson_build.sh b/hudson_build.sh deleted file mode 100644 index c2b85df0..00000000 --- a/hudson_build.sh +++ /dev/null @@ -1,6 +0,0 @@ -cd $WORKSPACE -virtualenv -q ve -source ./ve/bin/activate -pip install -q -E ./ve -r requirements.txt -pip install -q -E ./ve -r requirements-test.txt -django-admin.py test --settings=redakcja.settings.test diff --git a/logging.cfg b/logging.cfg deleted file mode 100644 index 9bfa56c2..00000000 --- a/logging.cfg +++ /dev/null @@ -1,29 +0,0 @@ -[loggers] -keys=root,fnp - -[handlers] -keys=console - -[formatters] -keys=default - -[logger_root] -level=DEBUG -handlers=console - -[logger_fnp] -level=DEBUG -handlers=console -qualname=fnp -propagate=0 - -[formatter_default] -format=%(asctime)s %(name)s/%(levelname)s :: %(module)s.%(funcName)s:%(lineno)d :: %(message)s -datefmt= -class=logging.Formatter - -[handler_console] -class=StreamHandler -level=DEBUG -formatter=default -args=(sys.stderr, ) \ No newline at end of file diff --git a/logging.cfg.dev b/logging.cfg.dev deleted file mode 100644 index 23a78331..00000000 --- a/logging.cfg.dev +++ /dev/null @@ -1,29 +0,0 @@ -[loggers] -keys=root,fnp - -[handlers] -keys=console - -[formatters] -keys=default - -[logger_root] -level=DEBUG -handlers=console - -[logger_fnp] -level=DEBUG -handlers=console -qualname=fnp -propagate=0 - -[formatter_default] -format=%(asctime)s %(name)s/%(levelname)s :: %(module)s.%(funcName)s:%(lineno)d :: %(message)s -datefmt= -class=logging.Formatter - -[handler_console] -class=FileHandler -level=DEBUG -formatter=default -args=('redakcja.dev.log', ) diff --git a/requirements-test.txt b/requirements-test.txt deleted file mode 100644 index 70ee4a0b..00000000 --- a/requirements-test.txt +++ /dev/null @@ -1,5 +0,0 @@ -django-nose==1.2 -nose -nosexcover -mock -selenium diff --git a/requirements/requirements-dev.txt b/requirements/requirements-dev.txt new file mode 100644 index 00000000..aec394f4 --- /dev/null +++ b/requirements/requirements-dev.txt @@ -0,0 +1 @@ +django-debug-toolbar diff --git a/requirements/requirements-test.txt b/requirements/requirements-test.txt new file mode 100644 index 00000000..49f7cff9 --- /dev/null +++ b/requirements/requirements-test.txt @@ -0,0 +1,3 @@ +coverage +mock +selenium diff --git a/requirements.txt b/requirements/requirements.txt similarity index 100% rename from requirements.txt rename to requirements/requirements.txt diff --git a/src/catalogue/tests/test_gallery.py b/src/catalogue/tests/test_gallery.py index 4b8ea3f4..5c239ad2 100644 --- a/src/catalogue/tests/test_gallery.py +++ b/src/catalogue/tests/test_gallery.py @@ -114,7 +114,6 @@ class GalleryAppendTests(TestCase): def test_none_indexed(self): - import nose.tools self.book2 = Book.create(self.user, 'book 2', slug='book2') self.make_gallery(self.book1, { '1-0001_1l' : 'aa', diff --git a/src/cover/tests.py b/src/cover/tests.py index be8d0033..a4f5a5e3 100644 --- a/src/cover/tests.py +++ b/src/cover/tests.py @@ -3,7 +3,6 @@ # This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later. # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # -from nose.tools import * from django.test import TestCase from cover.forms import FlickrForm diff --git a/src/dvcs/tests/tests.py b/src/dvcs/tests/tests.py index 06160cae..d4e9b0b1 100644 --- a/src/dvcs/tests/tests.py +++ b/src/dvcs/tests/tests.py @@ -1,4 +1,3 @@ -from nose.tools import * from django.test import TestCase from .models import ADocument @@ -10,7 +9,6 @@ class DocumentModelTests(TestCase): ) def test_empty_file(self): - assert False doc = ADocument.objects.create() self.assertTextEqual(doc.materialize(), u"") diff --git a/src/redakcja/settings/__init__.py b/src/redakcja/settings/__init__.py index b9bdf5dd..cc88ab8e 100644 --- a/src/redakcja/settings/__init__.py +++ b/src/redakcja/settings/__init__.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import import os.path -from redakcja.settings.defaults import * -from redakcja.localsettings import * - +from .defaults import * +from ..localsettings import * +import os PROJECT_ROOT = os.path.realpath(os.path.dirname(os.path.dirname(__file__))) diff --git a/src/redakcja/settings/defaults.py b/src/redakcja/settings/defaults.py index 688e2b6d..63f9e932 100644 --- a/src/redakcja/settings/defaults.py +++ b/src/redakcja/settings/defaults.py @@ -23,6 +23,8 @@ ADMINS = ( (u'Radek Czajka', 'radoslaw.czajka@nowoczesnapolska.org.pl'), ) +INTERNAL_IPS = ['127.0.0.1'] + MANAGERS = ADMINS # Local time zone for this installation. Choices can be found here: diff --git a/src/redakcja/settings/test.py b/src/redakcja/settings/test.py index c026af0f..55cc3e63 100644 --- a/src/redakcja/settings/test.py +++ b/src/redakcja/settings/test.py @@ -1,7 +1,3 @@ -# -# Nose tests -# - from redakcja.settings import * DATABASES = { diff --git a/src/wiki_img/tests.py b/src/wiki_img/tests.py index 65777379..2b342da6 100644 --- a/src/wiki_img/tests.py +++ b/src/wiki_img/tests.py @@ -1,4 +1,3 @@ -from nose.tools import * import wiki.models as models import shutil import tempfile @@ -6,7 +5,7 @@ import tempfile class TestStorageBase: def setUp(self): - self.dirpath = tempfile.mkdtemp(prefix='nosetest_') + self.dirpath = tempfile.mkdtemp(prefix='redakcja_test_') def tearDown(self): shutil.rmtree(self.dirpath) @@ -16,4 +15,4 @@ class TestDocumentStorage(TestStorageBase): def test_storage_empty(self): storage = models.DocumentStorage(self.dirpath) - eq_(storage.all(), []) + self.assertEqual(storage.all(), []) -- 2.20.1