Skip to content

Instantly share code, notes, and snippets.

@rmax
Created October 22, 2010 21:51
Show Gist options
  • Save rmax/641448 to your computer and use it in GitHub Desktop.
Save rmax/641448 to your computer and use it in GitHub Desktop.
Test Pass 122
test_remove_filename (__main__.GridFSTest) ... FAIL
======================================================================
FAIL: test_remove_filename (__main__.GridFSTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_put.py", line 18, in test_remove_filename
self.assertEqual(f._id, id2)
AssertionError: ObjectId('4cc20c88e779893aae0002d6') != ObjectId('4cc20c88e779893aae0002d8')
----------------------------------------------------------------------
Ran 1 test in 0.007s
FAILED (failures=1)
import gridfs
import pymongo
import unittest
class GridFSTest(unittest.TestCase):
def setUp(self):
self.db = pymongo.Connection()['test__gridfs']
def test_remove_filename(self):
fs = gridfs.GridFS(self.db)
id1 = fs.put("data", filename="foo")
id2 = fs.put("data", filename="foo")
id3 = fs.put("data", filename="bar")
f = fs.get_last_version("foo")
self.assertEqual(f._id, id2)
def tearDown(self):
conn = self.db.connection
for name in self.db.collection_names():
if not name.startswith('system.'):
self.db.drop_collection(name)
# XXX: don't drop because fails when running many times
# pymongo.errors.OperationFailure: command SON([('dropDatabase', 1)])
# failed: exception: caught boost exception: boost::filesystem::remove: Directory not empty:
#conn.drop_database(self.db)
del self.db
if __name__ == '__main__':
# run tests until fail
runner = unittest.TextTestRunner(verbosity=2)
test = GridFSTest('test_remove_filename')
i = 0
while True:
i += 1
print "Test Pass", i
result = runner.run(test)
if not result.wasSuccessful():
break
PASSED (successes=1)
Test Pass 542
test_put
GridFSTest
test_remove_filename ... [FAIL]
===============================================================================
[FAIL]: test_put.GridFSTest.test_remove_filename
Traceback (most recent call last):
File "/usr/lib/python2.6/unittest.py", line 279, in run
testMethod()
File "/home/rolando/test_put.py", line 18, in test_remove_filename
self.assertEqual(f._id, id2)
exceptions.AssertionError: ObjectId('4cc207dfe779892ef2000cae') != ObjectId('4cc207dfe779892ef2000cb0')
-------------------------------------------------------------------------------
Ran 1 tests in 0.011s
FAILED (failures=1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment