Re: Help for Python mock test suite needed

2016-08-17 Thread Barry Warsaw
On Aug 17, 2016, at 01:58 PM, Andreas Tille wrote:

>This exactly was my question:  Is there any advise how to inject
>sensible debugging code or any other strategies to find out what might
>be the problem.
>
>> So you can use the full power of your development environment to hunt
>> the problem: an interactive debugging session, etc. Use your Python
>> skills :-)  
>
>I'm afraid at first I need to enhance my Python skills ...

pdb is debugging 101: https://docs.python.org/3/library/pdb.html

Specifically, add this line to the code at the point where you want to start
inspecting the state of the program:

import pdb; pdb.set_trace()

Now run the test suite and when you hit the breakpoint, you can print values,
inspect object, step through calls, etc.  It may or may not help you solve the
problem, but you'll get a much better sense of what's actually going on, and
it should at least improve the quality of an upstream bug report.

Cheers,
-Barry



Re: Help for Python mock test suite needed

2016-08-17 Thread Andreas Tille
On Tue, Aug 16, 2016 at 06:23:43AM +1000, Ben Finney wrote:
> Andreas Tille  writes:
> 
> > Yes, this is what I guessed from the log.  However, how can I find out
> > why exactly the command is not called?
> 
> That seems to be a question to take up with the upstream developer,

Yes.

> or just normal Python debugging.

This exactly was my question:  Is there any advise how to inject
sensible debugging code or any other strategies to find out what might
be the problem.

> So you can use the full power of your development environment to hunt
> the problem: an interactive debugging session, etc. Use your Python
> skills :-)

I'm afraid at first I need to enhance my Python skills ...

Kind regards

Andreas.

-- 
http://fam-tille.de



Re: Help for Python mock test suite needed

2016-08-15 Thread Ben Finney
Andreas Tille  writes:

> Yes, this is what I guessed from the log.  However, how can I find out
> why exactly the command is not called?

That seems to be a question to take up with the upstream developer, or
just normal Python debugging.

Unless I'm misunderstanding, this doesn't appear to be a problem
specific to a Debian build environment, so I would guess it fails even
when simply running the test suite in a normal development environment.

So you can use the full power of your development environment to hunt
the problem: an interactive debugging session, etc. Use your Python
skills :-)

-- 
 \ “Broken promises don't upset me. I just think, why did they |
  `\ believe me?” —Jack Handey |
_o__)  |
Ben Finney



Re: Help for Python mock test suite needed

2016-08-15 Thread Andreas Tille
On Mon, Aug 15, 2016 at 05:00:52AM +1000, Ben Finney wrote:
> > https://paste.debian.net/789238/
> 
> That appears to be a simple failure when the test suite is run. The
> assertions, as reported, are in the ‘test_srst2’ module:
> 
> =
> […]
>   File "test_srst2.py", line 213, in test_run_bowtie_with_defaults
> run_mock.assert_called_once_with(expected_bowtie2_command)
>   File "/usr/lib/python2.7/dist-packages/mock/mock.py", line 947, in 
> assert_called_once_with
> raise AssertionError(msg)
> AssertionError: Expected 'run_command' to be called once. Called 0 times.
> 
> […]
> 
>   File "test_srst2.py", line 180, in test_run_bowtie_with_overide
> run_mock.assert_called_once_with(expected_bowtie2_command)
>   File "/usr/lib/python2.7/dist-packages/mock/mock.py", line 947, in 
> assert_called_once_with
> raise AssertionError(msg)
> AssertionError: Expected 'run_command' to be called once. Called 0 times.
> =
> 
> The tracebacks tell you what test case functions are emitting failures:
> 
>   File "test_srst2.py", line 213, in test_run_bowtie_with_defaults
>   File "test_srst2.py", line 180, in test_run_bowtie_with_overide
> 
> Within those test case functions you can see the exact command that was
> expected to be run. The assertion is that ‘srst2.run_command’ is
> expected to be called (with specific arguments), but is not called,
> hence the assertion fails.

Yes, this is what I guessed from the log.  However, how can I find out
why exactly the command is not called?

Kind regards

  Andreas.

-- 
http://fam-tille.de



Re: Help for Python mock test suite needed

2016-08-14 Thread Ben Finney
Andreas Tille  writes:

> https://paste.debian.net/789238/

That appears to be a simple failure when the test suite is run. The
assertions, as reported, are in the ‘test_srst2’ module:

=
[…]
  File "test_srst2.py", line 213, in test_run_bowtie_with_defaults
run_mock.assert_called_once_with(expected_bowtie2_command)
  File "/usr/lib/python2.7/dist-packages/mock/mock.py", line 947, in 
assert_called_once_with
raise AssertionError(msg)
AssertionError: Expected 'run_command' to be called once. Called 0 times.

[…]

  File "test_srst2.py", line 180, in test_run_bowtie_with_overide
run_mock.assert_called_once_with(expected_bowtie2_command)
  File "/usr/lib/python2.7/dist-packages/mock/mock.py", line 947, in 
assert_called_once_with
raise AssertionError(msg)
AssertionError: Expected 'run_command' to be called once. Called 0 times.
=

The tracebacks tell you what test case functions are emitting failures:

  File "test_srst2.py", line 213, in test_run_bowtie_with_defaults
  File "test_srst2.py", line 180, in test_run_bowtie_with_overide

Within those test case functions you can see the exact command that was
expected to be run. The assertion is that ‘srst2.run_command’ is
expected to be called (with specific arguments), but is not called,
hence the assertion fails.

-- 
 \ “Don't be afraid of missing opportunities. Behind every failure |
  `\ is an opportunity somebody wishes they had missed.” —Jane |
_o__)  Wagner, via Lily Tomlin |
Ben Finney



Re: Help for Python mock test suite needed

2016-08-14 Thread Andreas Tille
On Sun, Aug 14, 2016 at 10:39:37AM +1000, Ben Finney wrote:
> > There is no such link.
> 
> You could make one:
> 
> * Build the package using Sbuild (you are doing this already to ensure
>   the build works cleanly, right?)

I actually uses pbuilder / cowbuilder for this purpose.
 
> * Take the output from the Sbuild run.

I made sure my pbuilder log has LC_ALL=C.

> * Paste that file on .

https://paste.debian.net/789238/

> * Reply here with the link to that complete build log.

Done.  Hope this helps.

> This is an essential tool of collaborating on packaging: Ensure your
> builds are initiated in their entirety with a single command, and all
> output is captured for later inspect. This is why it's important to use
> Sbuild or something equivalent.

I admit I assumed that reproducing the log by doing a local build would
be more interesting but I'm perfectly fine by providing the log as well.
:-)

Kind regards

 Andreas.

-- 
http://fam-tille.de



Re: Help for Python mock test suite needed

2016-08-13 Thread Ben Finney
Andreas Tille  writes:

> Hi Scott,
>
> On Sat, Aug 13, 2016 at 12:41:42PM -0400, Scott Kitterman wrote:
> > > > 
> > > > Any more complete hint from a possibly bowtie2 user would be helpful
> > > > 
> > > >  Andreas.
> > > > 
> > > > [1] svn://anonscm.debian.org/debian-med/trunk/packages/srst2/trunk/
> > 
> > A link to a build log showing the test failure might be helpful.
>
> There is no such link.

You could make one:

* Build the package using Sbuild (you are doing this already to ensure
  the build works cleanly, right?)

* Take the output from the Sbuild run.

* Paste that file on .

* Reply here with the link to that complete build log.

This is an essential tool of collaborating on packaging: Ensure your
builds are initiated in their entirety with a single command, and all
output is captured for later inspect. This is why it's important to use
Sbuild or something equivalent.

-- 
 \  “Science embraces facts and debates opinion; religion embraces |
  `\opinion and debates the facts.” —Tom Heehler, _The Well-Spoken |
_o__)   Thesaurus_ |
Ben Finney



Re: Help for Python mock test suite needed (Was: Any help with problem of srst2 new versions tests suite failing to call bowtie2)

2016-08-13 Thread Andreas Tille
Hi Scott,

On Sat, Aug 13, 2016 at 12:41:42PM -0400, Scott Kitterman wrote:
> > > 
> > > Any more complete hint from a possibly bowtie2 user would be helpful
> > > 
> > >  Andreas.
> > > 
> > > [1] svn://anonscm.debian.org/debian-med/trunk/packages/srst2/trunk/
> 
> A link to a build log showing the test failure might be helpful.

There is no such link.  If it helps I could migrate from SVN to Git which
might lower the barrier for reproducing the issue.  The interesting part
of the build log is

cd tests && python test_slurm_srst2.py && python test_srst2.py 
...
--
Ran 11 tests in 0.040s

OK
.FF..
==
FAIL: test_run_bowtie_with_defaults (__main__.TestRunBowtie)
--
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/mock/mock.py", line 1305, in patched
return func(*args, **keywargs)
  File "test_srst2.py", line 213, in test_run_bowtie_with_defaults
run_mock.assert_called_once_with(expected_bowtie2_command)
  File "/usr/lib/python2.7/dist-packages/mock/mock.py", line 947, in 
assert_called_once_with
raise AssertionError(msg)
AssertionError: Expected 'run_command' to be called once. Called 0 times.

==
FAIL: test_run_bowtie_with_overide (__main__.TestRunBowtie)
--
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/mock/mock.py", line 1305, in patched
return func(*args, **keywargs)
  File "test_srst2.py", line 180, in test_run_bowtie_with_overide
run_mock.assert_called_once_with(expected_bowtie2_command)
  File "/usr/lib/python2.7/dist-packages/mock/mock.py", line 947, in 
assert_called_once_with
raise AssertionError(msg)
AssertionError: Expected 'run_command' to be called once. Called 0 times.

--
Ran 17 tests in 0.060s

FAILED (failures=2)


Kind regards

   Andreas.


-- 
http://fam-tille.de



Re: Help for Python mock test suite needed (Was: Any help with problem of srst2 new versions tests suite failing to call bowtie2)

2016-08-13 Thread Scott Kitterman
On Saturday, August 13, 2016 08:40:34 AM Andreas Tille wrote:
> Hi,
> 
> I've got no help on the Debian Med packaging list.  Is there any hint
> how I could track down a test Python suite issue what exact command
> was called and failed?
> 
> Thanks for any hint
> 
>   Andreas.
> 
> On Tue, Aug 09, 2016 at 11:32:40PM +0200, Andreas Tille wrote:
> > Hi,
> > 
> > I tried to update srst2[1] package to new upstream version.
> > Unfortunately its runtime test produces failures when calling bowtie2.
> > I just added some naive debugging code writing the actual system call
> > to a file - but this has not lead to a final solution even if I think
> > the invalid option -foo was wrong.
> > 
> > Any more complete hint from a possibly bowtie2 user would be helpful
> > 
> >  Andreas.
> > 
> > [1] svn://anonscm.debian.org/debian-med/trunk/packages/srst2/trunk/

A link to a build log showing the test failure might be helpful.

Scott K