Moved from nose to py.test (the former doesn't officially support py3k, which is limiting).

This commit is contained in:
Virgil Dupras 2010-07-13 11:10:45 +02:00
parent fdde538b66
commit 4d66b4667c
12 changed files with 120 additions and 12 deletions

2
README
View File

@ -32,7 +32,7 @@ General dependencies
- lxml, to read and write XML files. (http://codespeak.net/lxml/)
- Mako, to generate help files. (http://www.makotemplates.org/)
- PyYaml, for help files and the build system. (http://pyyaml.org/)
- Nose, to run unit tests. (http://somethingaboutorange.com/mrl/projects/nose/)
- py.test, to run unit tests. (http://codespeak.net/py/dist/test/)
OS X prerequisites
-----

View File

@ -9,8 +9,7 @@
import os
import logging
from nose.tools import eq_
from hsutil.testutil import eq_
from hsutil.testcase import TestCase
from hsutil import io
from hsutil.path import Path

28
core/tests/conftest.py Normal file
View File

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# Created By: Virgil Dupras
# Created On: 2010-07-11
# Copyright 2010 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/bsd_license
# This unit is required to make tests work with py.test. When running
import py
def get_testunit(item):
if hasattr(item, 'obj'):
testunit = py.builtin._getimself(item.obj)
if hasattr(testunit, 'global_setup'):
return testunit
def pytest_runtest_setup(item):
testunit = get_testunit(item)
if testunit is not None:
testunit.global_setup()
def pytest_runtest_teardown(item):
testunit = get_testunit(item)
if testunit is not None:
testunit.global_teardown()

View File

@ -10,10 +10,9 @@ import os.path as op
import os
import time
from nose.tools import eq_
from hsutil import io
from hsutil.path import Path
from hsutil.testutil import eq_
from hsutil.testcase import TestCase
from ..directories import *

View File

@ -8,11 +8,10 @@
import sys
from nose.tools import eq_
from hscommon import job
from hsutil.decorators import log_calls
from hsutil.misc import first
from hsutil.testutil import eq_
from hsutil.testcase import TestCase
from .. import engine

View File

@ -9,7 +9,7 @@
import cStringIO
from lxml import etree
from nose.tools import eq_
from hsutil.testutil import eq_
from ..ignore import *

View File

@ -11,9 +11,9 @@ import StringIO
import os.path as op
from lxml import etree
from nose.tools import eq_
from hsutil.path import Path
from hsutil.testutil import eq_
from hsutil.testcase import TestCase
from hsutil.misc import first

View File

@ -6,11 +6,11 @@
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/hs_license
from nose.tools import eq_
from hscommon import job
from hsutil import io
from hsutil.path import Path
from hsutil.testutil import eq_
from hsutil.testcase import TestCase
from .. import fs

28
core_me/tests/conftest.py Normal file
View File

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# Created By: Virgil Dupras
# Created On: 2010-07-11
# Copyright 2010 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/bsd_license
# This unit is required to make tests work with py.test. When running
import py
def get_testunit(item):
if hasattr(item, 'obj'):
testunit = py.builtin._getimself(item.obj)
if hasattr(testunit, 'global_setup'):
return testunit
def pytest_runtest_setup(item):
testunit = get_testunit(item)
if testunit is not None:
testunit.global_setup()
def pytest_runtest_teardown(item):
testunit = get_testunit(item)
if testunit is not None:
testunit.global_teardown()

28
core_pe/tests/conftest.py Normal file
View File

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# Created By: Virgil Dupras
# Created On: 2010-07-11
# Copyright 2010 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/bsd_license
# This unit is required to make tests work with py.test. When running
import py
def get_testunit(item):
if hasattr(item, 'obj'):
testunit = py.builtin._getimself(item.obj)
if hasattr(testunit, 'global_setup'):
return testunit
def pytest_runtest_setup(item):
testunit = get_testunit(item)
if testunit is not None:
testunit.global_setup()
def pytest_runtest_teardown(item):
testunit = get_testunit(item)
if testunit is not None:
testunit.global_teardown()

28
core_se/tests/conftest.py Normal file
View File

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# Created By: Virgil Dupras
# Created On: 2010-07-11
# Copyright 2010 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/bsd_license
# This unit is required to make tests work with py.test. When running
import py
def get_testunit(item):
if hasattr(item, 'obj'):
testunit = py.builtin._getimself(item.obj)
if hasattr(testunit, 'global_setup'):
return testunit
def pytest_runtest_setup(item):
testunit = get_testunit(item)
if testunit is not None:
testunit.global_setup()
def pytest_runtest_teardown(item):
testunit = get_testunit(item)
if testunit is not None:
testunit.global_teardown()

View File

@ -9,9 +9,8 @@
import hashlib
from nose.tools import eq_
from hsutil.testcase import TestCase
from hsutil.testutil import eq_
from core.fs import File
from core.tests.directories_test import create_fake_fs