minimongo tests fail out of the box
YoavShapira opened this issue · 0 comments
Clean virtualenv, latest minimongo:
============================= test session starts ==============================
platform darwin -- Python 2.7.2 -- pytest-2.0.1
collecting ... collected 105 items
minimongo/tests/test_model.py ............................
minimongo/tests/test_utils.py .........
venv/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg/setuptools/tests/test_bdist_egg.py ..
venv/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg/setuptools/tests/test_build_ext.py .
venv/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg/setuptools/tests/test_develop.py .
venv/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg/setuptools/tests/test_dist_info.py ..
venv/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg/setuptools/tests/test_easy_install.py .............
venv/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg/setuptools/tests/test_markerlib.py .
venv/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg/setuptools/tests/test_packageindex.py .....F..
venv/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg/setuptools/tests/test_resources.py ..............................F
venv/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg/setuptools/tests/test_sandbox.py .
venv/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg/setuptools/tests/test_sdist.py ...F..
venv/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg/setuptools/tests/test_test.py .
venv/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg/setuptools/tests/test_upload_docs.py .
=================================== FAILURES ===================================
_____________________ TestPackageIndex.test_links_priority _____________________
self = <setuptools.tests.test_packageindex.TestPackageIndex testMethod=test_links_priority>
def test_links_priority(self):
"""
Download links from the pypi simple index should be used before
external download links.
http://bitbucket.org/tarek/distribute/issue/163/md5-validation-error
Usecase :
- someone uploads a package on pypi, a md5 is generated
- someone manually copies this link (with the md5 in the url) onto an
external page accessible from the package page.
- someone reuploads the package (with a different md5)
- while easy_installing, an MD5 error occurs because the external link
is used
-> Distribute should use the link from pypi, not the external one.
"""
if sys.platform.startswith('java'):
# Skip this test on jython because binding to :0 fails
return
# start an index server
server = IndexServer()
server.start()
index_url = server.base_url() + 'test_links_priority/simple/'
# scan a test index
pi = setuptools.package_index.PackageIndex(index_url)
requirement = pkg_resources.Requirement.parse('foobar')
pi.find_packages(requirement)
server.stop()
# the distribution has been found
self.assertTrue('foobar' in pi)
venv/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg/setuptools/tests/test_packageindex.py:131:
self = <setuptools.tests.test_packageindex.TestPackageIndex testMethod=test_links_priority>
expr = False, msg = 'False is not true'
def assertTrue(self, expr, msg=None):
"""Check that the expression is true."""
if not expr:
msg = self._formatMessage(msg, "%s is not true" % safe_repr(expr))
raise self.failureException(msg)
E AssertionError: False is not true
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py:420: AssertionError
------------------------------- Captured stdout --------------------------------
Reading http://127.0.0.1:55186/setuptools/tests/indexes/test_links_priority/simple/foobar/
Scanning index of all packages (this may take a while)
Reading http://127.0.0.1:55186/setuptools/tests/indexes/test_links_priority/simple/
------------------------------- Captured stderr --------------------------------
1.0.0.127.in-addr.arpa - - [08/Jan/2013 10:36:33] code 404, message File not found
1.0.0.127.in-addr.arpa - - [08/Jan/2013 10:36:33] "GET /setuptools/tests/indexes/test_links_priority/simple/foobar/ HTTP/1.1" 404 -
Couldn't find index page for 'foobar' (maybe misspelled?)
1.0.0.127.in-addr.arpa - - [08/Jan/2013 10:36:33] code 404, message File not found
1.0.0.127.in-addr.arpa - - [08/Jan/2013 10:36:33] "GET /setuptools/tests/indexes/test_links_priority/simple/ HTTP/1.1" 404 -
1.0.0.127.in-addr.arpa - - [08/Jan/2013 10:36:33] "GET / HTTP/1.1" 200 -
_____________________ NamespaceTests.test_two_levels_deep ______________________
self = <setuptools.tests.test_resources.NamespaceTests testMethod=test_two_levels_deep>
def test_two_levels_deep(self):
"""
Test nested namespace packages
Create namespace packages in the following tree :
site-packages-1/pkg1/pkg2
site-packages-2/pkg1/pkg2
Check both are in the _namespace_packages dict and that their __path__
is correct
"""
sys.path.append(os.path.join(self._tmpdir, "site-pkgs2"))
os.makedirs(os.path.join(self._tmpdir, "site-pkgs", "pkg1", "pkg2"))
os.makedirs(os.path.join(self._tmpdir, "site-pkgs2", "pkg1", "pkg2"))
ns_str = "__import__('pkg_resources').declare_namespace(__name__)\n"
for site in ["site-pkgs", "site-pkgs2"]:
pkg1_init = open(os.path.join(self._tmpdir, site,
"pkg1", "__init__.py"), "w")
pkg1_init.write(ns_str)
pkg1_init.close()
pkg2_init = open(os.path.join(self._tmpdir, site,
"pkg1", "pkg2", "__init__.py"), "w")
pkg2_init.write(ns_str)
pkg2_init.close()
import pkg1
self._assertIn("pkg1", pkg_resources._namespace_packages.keys())
try:
import pkg1.pkg2
except ImportError, e:
self.fail("Distribute tried to import the parent namespace package")
# check the _namespace_packages dict
self._assertIn("pkg1.pkg2", pkg_resources._namespace_packages.keys())
self.assertEqual(pkg_resources._namespace_packages["pkg1"], ["pkg1.pkg2"])
# check the __path__ attribute contains both paths
self.assertEqual(pkg1.pkg2.__path__, [
os.path.join(self._tmpdir, "site-pkgs", "pkg1", "pkg2"),
os.path.join(self._tmpdir, "site-pkgs2", "pkg1", "pkg2") ])
venv/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg/setuptools/tests/test_resources.py:648:
self = <setuptools.tests.test_resources.NamespaceTests testMethod=test_two_levels_deep>
first = ['/private/var/folders/kg/nqgwfps95hbbfbdmwbyjgtzw0000gn/T/tests-distribute-oLvfWI/site-pkgs/pkg1/pkg2', '/private/var.../site-pkgs2/pkg1/pkg2', '/var/folders/kg/nqgwfps95hbbfbdmwbyjgtzw0000gn/T/tests-distribute-oLvfWI/site-pkgs/pkg1/pkg2']
second = ['/var/folders/kg/nqgwfps95hbbfbdmwbyjgtzw0000gn/T/tests-distribute-oLvfWI/site-pkgs/pkg1/pkg2', '/var/folders/kg/nqgwfps95hbbfbdmwbyjgtzw0000gn/T/tests-distribute-oLvfWI/site-pkgs2/pkg1/pkg2']
msg = None
def assertEqual(self, first, second, msg=None):
"""Fail if the two objects are unequal as determined by the '=='
operator.
"""
assertion_func = self._getAssertEqualityFunc(first, second)
assertion_func(first, second, msg=msg)
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py:509:
self = <setuptools.tests.test_resources.NamespaceTests testMethod=test_two_levels_deep>
list1 = ['/private/var/folders/kg/nqgwfps95hbbfbdmwbyjgtzw0000gn/T/tests-distribute-oLvfWI/site-pkgs/pkg1/pkg2', '/private/var.../site-pkgs2/pkg1/pkg2', '/var/folders/kg/nqgwfps95hbbfbdmwbyjgtzw0000gn/T/tests-distribute-oLvfWI/site-pkgs/pkg1/pkg2']
list2 = ['/var/folders/kg/nqgwfps95hbbfbdmwbyjgtzw0000gn/T/tests-distribute-oLvfWI/site-pkgs/pkg1/pkg2', '/var/folders/kg/nqgwfps95hbbfbdmwbyjgtzw0000gn/T/tests-distribute-oLvfWI/site-pkgs2/pkg1/pkg2']
msg = None
def assertListEqual(self, list1, list2, msg=None):
"""A list-specific equality assertion.
Args:
list1: The first list to compare.
list2: The second list to compare.
msg: Optional message to use on failure instead of a list of
differences.
"""
self.assertSequenceEqual(list1, list2, msg, seq_type=list)
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py:738:
self = <setuptools.tests.test_resources.NamespaceTests testMethod=test_two_levels_deep>
seq1 = ['/private/var/folders/kg/nqgwfps95hbbfbdmwbyjgtzw0000gn/T/tests-distribute-oLvfWI/site-pkgs/pkg1/pkg2', '/private/var.../site-pkgs2/pkg1/pkg2', '/var/folders/kg/nqgwfps95hbbfbdmwbyjgtzw0000gn/T/tests-distribute-oLvfWI/site-pkgs/pkg1/pkg2']
seq2 = ['/var/folders/kg/nqgwfps95hbbfbdmwbyjgtzw0000gn/T/tests-distribute-oLvfWI/site-pkgs/pkg1/pkg2', '/var/folders/kg/nqgwfps95hbbfbdmwbyjgtzw0000gn/T/tests-distribute-oLvfWI/site-pkgs2/pkg1/pkg2']
msg = "Lists differ: ['/private/var/folders/kg/nqgw... != ['/var/folders/kg/nqgwfps95hbb...\n\nFirst differing element 0:\n/...vfWI/site-pkgs2/pkg1/pkg2']\n? +\n"
seq_type = <type 'list'>
def assertSequenceEqual(self, seq1, seq2, msg=None, seq_type=None):
"""An equality assertion for ordered sequences (like lists and tuples).
For the purposes of this function, a valid ordered sequence type is one
which can be indexed, has a length, and has an equality operator.
Args:
seq1: The first sequence to compare.
seq2: The second sequence to compare.
seq_type: The expected datatype of the sequences, or None if no
datatype should be enforced.
msg: Optional message to use on failure instead of a list of
differences.
"""
if seq_type is not None:
seq_type_name = seq_type.__name__
if not isinstance(seq1, seq_type):
raise self.failureException('First sequence is not a %s: %s'
% (seq_type_name, safe_repr(seq1)))
if not isinstance(seq2, seq_type):
raise self.failureException('Second sequence is not a %s: %s'
% (seq_type_name, safe_repr(seq2)))
else:
seq_type_name = "sequence"
differing = None
try:
len1 = len(seq1)
except (TypeError, NotImplementedError):
differing = 'First %s has no length. Non-sequence?' % (
seq_type_name)
if differing is None:
try:
len2 = len(seq2)
except (TypeError, NotImplementedError):
differing = 'Second %s has no length. Non-sequence?' % (
seq_type_name)
if differing is None:
if seq1 == seq2:
return
seq1_repr = safe_repr(seq1)
seq2_repr = safe_repr(seq2)
if len(seq1_repr) > 30:
seq1_repr = seq1_repr[:30] + '...'
if len(seq2_repr) > 30:
seq2_repr = seq2_repr[:30] + '...'
elements = (seq_type_name.capitalize(), seq1_repr, seq2_repr)
differing = '%ss differ: %s != %s\n' % elements
for i in xrange(min(len1, len2)):
try:
item1 = seq1[i]
except (TypeError, IndexError, NotImplementedError):
differing += ('\nUnable to index element %d of first %s\n' %
(i, seq_type_name))
break
try:
item2 = seq2[i]
except (TypeError, IndexError, NotImplementedError):
differing += ('\nUnable to index element %d of second %s\n' %
(i, seq_type_name))
break
if item1 != item2:
differing += ('\nFirst differing element %d:\n%s\n%s\n' %
(i, item1, item2))
break
else:
if (len1 == len2 and seq_type is None and
type(seq1) != type(seq2)):
# The sequences are the same, but have differing types.
return
if len1 > len2:
differing += ('\nFirst %s contains %d additional '
'elements.\n' % (seq_type_name, len1 - len2))
try:
differing += ('First extra element %d:\n%s\n' %
(len2, seq1[len2]))
except (TypeError, IndexError, NotImplementedError):
differing += ('Unable to index element %d '
'of first %s\n' % (len2, seq_type_name))
elif len1 < len2:
differing += ('\nSecond %s contains %d additional '
'elements.\n' % (seq_type_name, len2 - len1))
try:
differing += ('First extra element %d:\n%s\n' %
(len1, seq2[len1]))
except (TypeError, IndexError, NotImplementedError):
differing += ('Unable to index element %d '
'of second %s\n' % (len1, seq_type_name))
standardMsg = differing
diffMsg = '\n' + '\n'.join(
difflib.ndiff(pprint.pformat(seq1).splitlines(),
pprint.pformat(seq2).splitlines()))
standardMsg = self._truncateMessage(standardMsg, diffMsg)
msg = self._formatMessage(msg, standardMsg)
self.fail(msg)
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py:720:
self = <setuptools.tests.test_resources.NamespaceTests testMethod=test_two_levels_deep>
msg = "Lists differ: ['/private/var/folders/kg/nqgw... != ['/var/folders/kg/nqgwfps95hbb...\n\nFirst differing element 0:\n/...vfWI/site-pkgs2/pkg1/pkg2']\n? +\n"
def fail(self, msg=None):
"""Fail immediately, with the given message."""
raise self.failureException(msg)
E AssertionError: Lists differ: ['/private/var/folders/kg/nqgw... != ['/var/folders/kg/nqgwfps95hbb...
E
E First differing element 0:
E /private/var/folders/kg/nqgwfps95hbbfbdmwbyjgtzw0000gn/T/tests-distribute-oLvfWI/site-pkgs/pkg1/pkg2
E /var/folders/kg/nqgwfps95hbbfbdmwbyjgtzw0000gn/T/tests-distribute-oLvfWI/site-pkgs/pkg1/pkg2
E
E First list contains 1 additional elements.
E First extra element 2:
E /var/folders/kg/nqgwfps95hbbfbdmwbyjgtzw0000gn/T/tests-distribute-oLvfWI/site-pkgs/pkg1/pkg2
E
E - ['/private/var/folders/kg/nqgwfps95hbbfbdmwbyjgtzw0000gn/T/tests-distribute-oLvfWI/site-pkgs/pkg1/pkg2',
E ? --------
E
E + ['/var/folders/kg/nqgwfps95hbbfbdmwbyjgtzw0000gn/T/tests-distribute-oLvfWI/site-pkgs/pkg1/pkg2',
E - '/private/var/folders/kg/nqgwfps95hbbfbdmwbyjgtzw0000gn/T/tests-distribute-oLvfWI/site-pkgs2/pkg1/pkg2',
E - '/var/folders/kg/nqgwfps95hbbfbdmwbyjgtzw0000gn/T/tests-distribute-oLvfWI/site-pkgs/pkg1/pkg2']
E + '/var/folders/kg/nqgwfps95hbbfbdmwbyjgtzw0000gn/T/tests-distribute-oLvfWI/site-pkgs2/pkg1/pkg2']
E ? +
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py:408: AssertionError
____________ TestSdistTest.test_sdist_with_latin1_encoded_filename _____________
self = <setuptools.tests.test_sdist.TestSdistTest testMethod=test_sdist_with_latin1_encoded_filename>
def test_sdist_with_latin1_encoded_filename(self):
# Test for #303.
dist = Distribution(SETUP_ATTRS)
dist.script_name = 'setup.py'
cmd = sdist(dist)
cmd.ensure_finalized()
# Latin-1 filename
filename = os.path.join(b('sdist_test'), LATIN1_FILENAME)
open(filename, 'w').close()
quiet()
try:
cmd.run()
finally:
unquiet()
if sys.version_info >= (3,):
filename = filename.decode('latin-1')
if sys.platform == 'win32':
# Latin-1 is similar to Windows-1252
self.assertTrue(filename in cmd.filelist.files)
else:
# The Latin-1 filename should have been skipped
self.assertFalse(filename in cmd.filelist.files)
else:
# No conversion takes place under Python 2 and the file
# is included. We shall keep it that way for BBB.
self.assertTrue(filename in cmd.filelist.files)
venv/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg/setuptools/tests/test_sdist.py:378:
self = <setuptools.tests.test_sdist.TestSdistTest testMethod=test_sdist_with_latin1_encoded_filename>
expr = False, msg = 'False is not true'
def assertTrue(self, expr, msg=None):
"""Check that the expression is true."""
if not expr:
msg = self._formatMessage(msg, "%s is not true" % safe_repr(expr))
raise self.failureException(msg)
E AssertionError: False is not true
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py:420: AssertionError
==================== 3 failed, 102 passed in 78.16 seconds =====================