Re: [Paste] Can I use scripttest's TestFileEnv.run without affecting
the result?
On Tue, May 11, 2010 at 10:01 AM, Jason Baker <amnorvend@???> wrote:
> Here's a test I want to run:
>
> python_script = os.path.join('bin', 'python')
> class TestNoCreateVenv(BaseTest):
> def test(self):
> self.env.run('envb setup')
> result = self.env.run('envb setup -N')
> assert python_script not in result.files_updated
>
> The first command ('envb setup') doesn't really need to be run in
> scripttest. I'm already testing its output in another test. I'm just
> doing it this way because it's so much easier than importing
> subprocess and using it. :-)
>
> At any rate, the first command is assumed to create a virtualenv in
> the test directory. However, the second command *should not* create a
> virtualenv. I'm testing this by making sure that it's not updating
> bin/python. If I run this test, I get the following output:
>
> ======================================================================
> FAIL: tests.system_tests.test_setup.TestNoCreateVenv.test
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File "/home/jason/.virtualenvs/main/lib/python2.6/site-packages/nose/
> case.py", line 186, in runTest
> self.test(*self.arg)
> File "/home/jason/src/envbuilder/tests/system_tests/test_setup.py",
> line 23, in test
> assert python_script not in result.files_updated
> AssertionError
> ----------------------------------------------------------------------
>
> It seems as though it's keeping the results from the first env.run.
> Is there any way to make scripttest only consider the results from the
> second env.run?
>
That's not how it should work -- it should look at all the files right
before it calls the subprocess, then call it, then look again. Are you sure
that file isn't actually updated? (It occurs to me that it would be handy
if ScriptTest kept diffs too.) Also the file is updated, not created, which
makes it seem to me like it really was changed.
--
Ian Bicking | http://blog.ianbicking.org
--
You received this message because you are subscribed to the Google Groups "Paste Users" group.
To post to this group, send email to paste-users@???.
To unsubscribe from this group, send email to paste-users+unsubscribe@???.
For more options, visit this group at http://groups.google.com/group/paste-users?hl=en.