[Twisted-Python] trial newbie
Okay, so I'm just starting to learn how to use trial (I know, I'm a bad, bad boy), and I'm having trouble getting started. The trial page[1] says "Tests that subclass the standard library TestCase and don't do anything "too weird" should be able to be discoverable and runnable by the Trial test runner without the authors of those tests having to jump through hoops." So I made a small concept file to try that out: =-=-=-=-=-=-=- #!/usr/bin/env python import unittest, sys from distutils import version class TestPrerequsites(unittest.TestCase): def setUp(self): pass def test_00(self): "Supported OS?" self.assertTrue(sys.platform in ['darwin']) if __name__ == '__main__': unittest.main() =-=-=-=-=-=-=- I named it 'test.py' and made sure it worked with python: =-=-=-=-=-=-=- $ python test.py -v Supported OS? ... ok ---------------------------------------------------------------------- Ran 1 test in 0.000s OK =-=-=-=-=-=-=- and then I tried running it in trial under Twisted 8.2.0 on OS 10.6...and it crashed...sorta. A traceback was output, but after the traceback stuff it also seemed to run the test. So I thought, "I probably just need to upgrade." So I upgraded to Twisted 10.1.0 and ran it again. It still crashed...sorta. Here's what it looks like. $ trial test.py Traceback (most recent call last): File "/Library/Python/2.6/site-packages/Twisted-10.1.0-py2.6-macosx-10.6-universal.egg/twisted/python/usage.py", line 241, in parseOptions self.postOptions() File "/Library/Python/2.6/site-packages/Twisted-10.1.0-py2.6-macosx-10.6-universal.egg/twisted/scripts/trial.py", line 295, in postOptions self['reporter'] = self._loadReporterByName(self['reporter']) File "/Library/Python/2.6/site-packages/Twisted-10.1.0-py2.6-macosx-10.6-universal.egg/twisted/scripts/trial.py", line 281, in _loadReporterByName for p in plugin.getPlugins(itrial.IReporter): File "/Library/Python/2.6/site-packages/Twisted-10.1.0-py2.6-macosx-10.6-universal.egg/twisted/plugin.py", line 199, in getPlugins allDropins = getCache(package) --- <exception caught here> --- File "/Library/Python/2.6/site-packages/Twisted-10.1.0-py2.6-macosx-10.6-universal.egg/twisted/plugin.py", line 178, in getCache dropinPath.setContent(pickle.dumps(dropinDotCache)) File "/Library/Python/2.6/site-packages/Twisted-10.1.0-py2.6-macosx-10.6-universal.egg/twisted/python/filepath.py", line 745, in setContent f = sib.open('w') File "/Library/Python/2.6/site-packages/Twisted-10.1.0-py2.6-macosx-10.6-universal.egg/twisted/python/filepath.py", line 495, in open return self.create() File "/Library/Python/2.6/site-packages/Twisted-10.1.0-py2.6-macosx-10.6-universal.egg/twisted/python/filepath.py", line 771, in create fdint = os.open(self.path, _CREATE_FLAGS) exceptions.OSError: [Errno 13] Permission denied: '/Library/Python/2.6/site-packages/Twisted-10.1.0-py2.6-macosx-10.6-universal.egg/twisted/plugins/n8ARdewBqzybvuUpdropin.cache.new' test TestPrerequsites test_00 ... [OK] ------------------------------------------------------------------------------- Ran 1 tests in 0.023s PASSED (successes=1) Anyone know what's going on? I installed/upgraded version 10.1.0 by downloading the tarball and running "sudo python setup.py install" ~ Nathan [1] http://twistedmatrix.com/documents/current/api/twisted.trial.html
On 7/21/10 7:30 PM, Nathan wrote:
Anyone know what's going on? I installed/upgraded version 10.1.0 by downloading the tarball and running "sudo python setup.py install"
http://twistedmatrix.com/trac/wiki/FrequentlyAskedQuestions FAQ 3.20 (Search for "Permission denied") You can follow the advice there, or you should also be able to run "sudo twistd --help" to rewrite the plugin cache and get rid of the error.
On Wed, Jul 21, 2010 at 6:29 PM, Lucas Taylor
On 7/21/10 7:30 PM, Nathan wrote:
Anyone know what's going on? I installed/upgraded version 10.1.0 by downloading the tarball and running "sudo python setup.py install"
http://twistedmatrix.com/trac/wiki/FrequentlyAskedQuestions FAQ 3.20 (Search for "Permission denied")
You can follow the advice there, or you should also be able to run "sudo twistd --help" to rewrite the plugin cache and get rid of the error.
That was it, thanks! I ran "sudo twistd --help" like you suggested and now everything runs without error. ~ Nathan
participants (2)
-
Lucas Taylor
-
Nathan