summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Le Marec - Pasquet <kiorky@cryptelium.net>2014-01-29 13:58:16 +0100
committerMathieu Le Marec - Pasquet <kiorky@cryptelium.net>2014-01-29 13:58:16 +0100
commitf525f062d7b359c4305a8ee42421e7d4f9f1cc21 (patch)
tree8087ca183b092944f45bc78687462b08711c2940
parent61f0b322de71f1ce0d2d861cc8d8469d158f8107 (diff)
downloadcroniter-f525f062d7b359c4305a8ee42421e7d4f9f1cc21.tar.gz
switch over nose for tests
-rw-r--r--.gitignore3
-rw-r--r--buildout.cfg42
-rw-r--r--src/croniter/testing.py19
-rw-r--r--src/croniter/tests/base.py33
-rw-r--r--src/croniter/tests/test_croniter.py7
-rw-r--r--src/croniter/tests/test_doctests.py56
6 files changed, 25 insertions, 135 deletions
diff --git a/.gitignore b/.gitignore
index ba2998e..16e4b89 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,7 @@
*app.pyc
+distribute*
+.tox
+tox.ini
t/
eggs
\.*.cfg
diff --git a/buildout.cfg b/buildout.cfg
index 875f91c..908b3d2 100644
--- a/buildout.cfg
+++ b/buildout.cfg
@@ -3,11 +3,12 @@ package-name = croniter
develop = .
versions=versions
parts =
+# tox
scripts
omelette
- test
coverage
report
+ test
report-xml
code-analysis
extensions =
@@ -28,36 +29,18 @@ recipe=zc.recipe.egg
eggs = ${buildout:eggs}
zest.releaser
ipython
-interpreter = scripts
-scripts =
- ipython
- croniter
- fullrelease
- paster
+ tox
nose
- nosetests
- fullrelease
- lasttagdiff
- lasttaglog
- longtest
- postrelease
- prerelease
- release
- rst2html.py
- rst2latex.py
- rst2man.py
- rst2odt_prepstyles.py
- rst2odt.py
- rst2pseudoxml.py
- rst2s5.py
- rst2xetex.py
- rst2xml.py
- rstpep2html.py
+interpreter = scripts
[test]
-recipe = zc.recipe.testrunner
-defaults = ['-v', '-s', '${buildout:package-name}']
-eggs = ${buildout:test-eggs}
+recipe=zc.recipe.egg
+eggs = ${scripts:eggs}
+ croniter[test]
+arguments= ['croniter']
+scripts=test
+entry-points=
+ test=nose:run_exit
[coverage]
recipe = zc.recipe.egg
@@ -134,6 +117,3 @@ zope.browser = 2.0.2
zope.component = 4.1.0
zope.configuration = 4.0.2
-
-
-
diff --git a/src/croniter/testing.py b/src/croniter/testing.py
deleted file mode 100644
index 3eeaf84..0000000
--- a/src/croniter/testing.py
+++ /dev/null
@@ -1,19 +0,0 @@
-from plone.testing.layer import Layer as Base
-
-
-class Layer(Base):
-
- defaultBases = tuple()
-
-
-class IntegrationLayer(Layer):
- """."""
-
-
-class FunctionnalLayer(IntegrationLayer):
- """."""
-
-
-CRONITER_FIXTURE = Layer()
-CRONITER_INTEGRATION_TESTING = IntegrationLayer()
-CRONITER_FUNCTIONAL_TESTING = FunctionnalLayer()
diff --git a/src/croniter/tests/base.py b/src/croniter/tests/base.py
index 583f92a..e3ded73 100644
--- a/src/croniter/tests/base.py
+++ b/src/croniter/tests/base.py
@@ -1,31 +1,12 @@
-import unittest2 as unittest
-
-from croniter.testing import (
- CRONITER_FIXTURE as UNIT_TESTING,
- CRONITER_INTEGRATION_TESTING as INTEGRATION_TESTING,
- CRONITER_FUNCTIONAL_TESTING as FUNCTIONAL_TESTING,
-)
-
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
class TestCase(unittest.TestCase):
- """We use this base class for all the tests in this package.
+ '''
+ We use this base class for all the tests in this package.
If necessary, we can put common utility or setup code in here.
- """
- layer = UNIT_TESTING
-
- def setUp(self):
- super(TestCase, self).setUp()
-
-
-class IntegrationTestCase(TestCase):
- """Integration base TestCase."""
- layer = INTEGRATION_TESTING
-
-
-class FunctionalTestCase(TestCase):
- """Functionnal base TestCase."""
- layer = FUNCTIONAL_TESTING
-
-
+ '''
# vim:set ft=python:
diff --git a/src/croniter/tests/test_croniter.py b/src/croniter/tests/test_croniter.py
index 155fa07..a159582 100644
--- a/src/croniter/tests/test_croniter.py
+++ b/src/croniter/tests/test_croniter.py
@@ -10,6 +10,7 @@ from croniter.tests import base
class CroniterTest(base.TestCase):
+
def testSecond(self):
base = datetime(2012, 4, 6, 13, 26, 10)
itr = croniter('*/1 * * * * *', base)
@@ -258,7 +259,7 @@ class CroniterTest(base.TestCase):
self.assertEqual(n1.minute, 5)
def testBug2(self):
- base = datetime(2012, 1, 1, 00, 00)
+ base = datetime(2012, 1, 1, 0, 0)
iter = croniter('0 * * 3 *', base)
n1 = iter.get_next(datetime)
self.assertEqual(n1.year, base.year)
@@ -334,7 +335,7 @@ class CroniterTest(base.TestCase):
self.assertEqual(prev1.minute, 59)
def testPreviousDay(self):
- base = datetime(2012, 6, 27, 00, 15)
+ base = datetime(2012, 6, 27, 0, 15)
itr = croniter('* * 26 * *', base)
prev1 = itr.get_prev(datetime)
self.assertEqual(prev1.year, base.year)
@@ -344,7 +345,7 @@ class CroniterTest(base.TestCase):
self.assertEqual(prev1.minute, 59)
def testPreviousMonth(self):
- base = datetime(2012, 6, 18, 00, 15)
+ base = datetime(2012, 6, 18, 0, 15)
itr = croniter('* * * 5 *', base)
prev1 = itr.get_prev(datetime)
self.assertEqual(prev1.year, base.year)
diff --git a/src/croniter/tests/test_doctests.py b/src/croniter/tests/test_doctests.py
deleted file mode 100644
index 0693bb6..0000000
--- a/src/croniter/tests/test_doctests.py
+++ /dev/null
@@ -1,56 +0,0 @@
-"""
-Launching all doctests in the tests directory using:
-
- - the base layer in testing.py
-
-"""
-
-# GLOBALS avalaible in doctests
-# IMPORT/DEFINE objects there or inside ./user_globals.py (better)
-# globals from the testing product are also available.
-# example:
-# from for import bar
-# and in your doctests, you can do:
-# >>> bar.something
-from croniter.testing import CRONITER_FUNCTIONAL_TESTING as FUNCTIONAL_TESTING
-
-
-import unittest2 as unittest
-import glob
-import os
-import logging
-import doctest
-from plone.testing import layered
-
-optionflags = (doctest.ELLIPSIS
- | doctest.NORMALIZE_WHITESPACE
- | doctest.REPORT_ONLY_FIRST_FAILURE)
-
-
-def test_suite():
- """."""
- logger = logging.getLogger('croniter')
- cwd = os.path.dirname(__file__)
- files = []
- try:
- files = glob.glob(os.path.join(cwd, '*txt'))
- files += glob.glob(os.path.join(cwd, '*rst'))
- except Exception:
- logger.warn('No doctests for croniter')
- suite = unittest.TestSuite()
- globs = globals()
- for s in files:
- suite.addTests([
- layered(
- doctest.DocFileSuite(
- s,
- globs=globs,
- module_relative=False,
- optionflags=optionflags,
- ),
- layer=FUNCTIONAL_TESTING
- ),
- ])
- return suite
-
-#