Thanks eryksun.
There's a list for testing in python which I also posed the question to and
got pretty much the same answer as you provided.
The line if proc.returncode != 1 was a mistake. That 1 should have been a
zero.
As this question was just about mock and not really dealing with the bad
re
On Fri, Jan 17, 2014 at 4:58 AM, James Chapman wrote:
> import mock
> import unittest
> import pinger
>
> class Test_Pinger(unittest.TestCase):
>
> def test_ping_host_succeeds(self):
> pinger = pinger.Pinger()
Are you using CPython? That raises an UnboundLocalError. Take a look
at the
On Fri, Jan 17, 2014 at 09:58:06AM +, James Chapman wrote:
> As this question was just about mock and not really dealing with the bad
> return code or exception handling or raising my final working example looks
> like this:
Your final *working* example? I don't think so. I can see at least t
Erm...?
CPython yeah.
If I rename "pinger.py" to "tutor.py" and change the unittest it runs fine.
Why?
-
import mock
import unittest
import tutor
class Test_Pinger(unittest.TestCase):
def test_ping_host_succeeds(self):
pinger = tutor.Pinger()
with m
Ah of course!
pinger = pinger.Pinger() I should have noticed that myself. (I
renamed the file to pinger.py after establishing it all worked and then
didn't re-run).
ping = pinger.Pinger() works fine.
As for the syntax errors, those will be copy paste / different email client
errors.
--
Jame
On Fri, Jan 17, 2014 at 6:23 AM, Steven D'Aprano wrote:
> On Fri, Jan 17, 2014 at 09:58:06AM +, James Chapman wrote:
>
>> import subprocess
>> class Pinger(object):
>
> There is your first SyntaxError, a stray space ahead of the "class"
> keyword.
The rich text version is correct (and colorf
Really!
import mock
import unittest
import pinger
It should be three lines, but somehow it got all messed up, either
through rich text formatting or copy paste.
Being a bit pedantic now about import statements which are clearly
unintentionally messed up.
- Sent in plain text.
--
James
On
Steven D'Aprano Wrote in message:
> On Fri, Jan 17, 2014 at 08:35:04AM -0500, eryksun wrote:
>> On Fri, Jan 17, 2014 at 6:23 AM, Steven D'Aprano wrote:
>> > On Fri, Jan 17, 2014 at 09:58:06AM +, James Chapman wrote:
> [...]
>> >> import mockimport unittestimport pinger
>> >> class Test_Ping
On Fri, Jan 17, 2014 at 08:35:04AM -0500, eryksun wrote:
> On Fri, Jan 17, 2014 at 6:23 AM, Steven D'Aprano wrote:
> > On Fri, Jan 17, 2014 at 09:58:06AM +, James Chapman wrote:
[...]
> >> import mockimport unittestimport pinger
> >> class Test_Pinger(unittest.TestCase):
> >
> > And here you
On Fri, Jan 17, 2014 at 10:32 AM, Steven D'Aprano wrote:
> import mockimport
> unittestimport
> pinger
>
>
> would not be "fine".
Screenshot:
http://i.imgur.com/wSihI1X.png
The following is in a tag, so the whitespace is rendered literally:
import mock
import unittest
import pinger
class
---
On Fri, Jan 17, 2014 at 11:05:24AM -0500, Dave Angel wrote:
> Steven D'Aprano Wrote in message:
> > import mockimport
> > unittestimport
> > pinger
> >
> >
> > would not be "fine".
> >
> >
> You're putting the linefeeds in the wrong places.
Of course I am!
You would be amazed at how lon
On Fri, Jan 17, 2014 at 03:43:58PM +, James Chapman wrote:
> Really!
>
> import mock
> import unittest
> import pinger
>
> It should be three lines, but somehow it got all messed up, either
> through rich text formatting or copy paste.
Yes, I see what's going on now, excuse the noise. But th
On 18/01/14 00:49, Steven D'Aprano wrote:
which got mangled into plain text as:
import mockIMPORT unittestIMPORT pinger
(highlighting the latter two imports for emphasis), and not what my
brain was telling me, which was "import mock unittest pinger".
If its any consolation I did exactly t
13 matches
Mail list logo