Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #19132
| Date | 2012-01-19 17:11 +0000 |
|---|---|
| From | Andrea Crotti <andrea.crotti.0@gmail.com> |
| Subject | importing and nose |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4866.1326993075.27778.python-list@python.org> (permalink) |
I'm writing some code to analyse pstats statistics, and I'm trying to
have some working unit tests.
Suppose I have in the test directory another directory 'profiling',
which contains 'x.py', and 'b.py'.
Now running the following code in a script works perfectly,
class TestStatParser(unittest.TestCase):
def setUp(self):
self.temp_file = tempfile.mktemp()
prof_path = path.join(path.dirname(__file__), 'profiling')
sys.path.append(prof_path)
import x
profile.run('x.f1()', filename=self.temp_file)
But running it within nose I get the following
exec cmd in globals, locals
File "<string>", line 1, in <module>
NameError: name 'x' is not defined
Which doesn't make sense to me, because the import doesn't actually
fails, so
how can x not be defined???
Any clue?
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
importing and nose Andrea Crotti <andrea.crotti.0@gmail.com> - 2012-01-19 17:11 +0000
csiph-web