advice on running book code samples (nosetests not working)

1 view
Skip to first unread message

Paul Howell

unread,
Jun 1, 2007, 1:50:29 PM6/1/07
to tg.book
Hi all,

In short, I downloaded the code for bookmarker (Chap 4 sample code)
from ...book.com/code.html and it runs fine, but the nosetests are not
running. I'm running on my Mac, nosetests worked fine on the folder
that I generated myself, but when I downloaded this one and set it up,
nosetests seem to be not finding any tests! I get:

Ran 0 tests in 0.210s

I thought that nosetests would just automagically find any tests in my
project, but it isn't happening. I looked for some config where they
might be turned off, but can't find anything. Any suggestions?

In long...
So I finished Chapter 4 alright, and added my 2 cents to the . But
starting Chap 5 is impossible using the bookmarker code that you end
up with by following the book and typing in the code (I always do
that, rather than downloading it. I learn more that way). You can
try Chap 5 without downloading the code, but the very first errors (p.
61) don't exist because it comes from test_functional.py, a file never
created by following the text of Chap 4. I found it in the downloaded
code, but my nosetests aren't working. They still work in the folder
I typed in myself, btw.

Thanks for any help.
Paul
ps. fresh TG install two days ago, fresh nose from cheeseshop
yesterday, etc.

Paul Howell

unread,
Jun 1, 2007, 3:24:12 PM6/1/07
to tg.book
I'm getting there, tests are partially working now. Instead of
copying the sample code folder in and trying to run it, I've quick-
started a fresh project and am bringing in the code. The copied test
files are NOT working, but if I bring in the tests one by one with the
newer import info at the top, they are working. So I think that
there's been a change in how they were called and the old testing code
simply isn't working on 1.0.2.2.... i think. I'll get there. But any
advice is welcome :)
Paul

Mark Ramm

unread,
Jun 1, 2007, 4:31:11 PM6/1/07
to tgb...@googlegroups.com
I'll probably be able to take a look at this later this evening (after
work and other commitments).

If you could send me a tar or zip of the non-working test code that
will help a lot. (Feel free to e-mail me directly if you don't want
your code on-list.)

--Mark


--
Mark Ramm-Christensen
email: mark at compoundthinking dot com
blog: www.compoundthinking.com/blog

atobe

unread,
Jun 6, 2007, 5:35:42 AM6/6/07
to tg.book
Hello,

I had a problem with the execute permissions being set on py source
files. It seems that nosetests won't run python files that have this
bit set.

Picked up on this issue from this thread:
http://www.nabble.com/nosetest-not-working-on-a-quickstarted-project-(using-tg-1.0b2)-t2907156.html

I downloaded the zip from http://www.turbogearsbook.com/code/bookmarker-v1.zip
and let the Finder on my Mac unzip it.

I ran into the same problem as Paul and 'solved' it with: chmod uog-x
*.py in the .../bookmarker-V1/bookmarker/bookmarker/tests directory

I say solved because the tests are still failing but at least they are
running now...Oh and my nosetests is version 0.9.2, from darwinports.

Ah... so the two tests that are still failing are because the patterns
in the test don't match the text in the templates, specifically upper
vs lowercase.

line #15 in test_functional.py:

assert '<TITLE>Boomarker</TITLE>' in cherrypy.response.body[0]

should be:

assert '<title>Boomarker</title>' in cherrypy.response.body[0]


fixed, all good.
HTH


On Jun 1, 9:31 pm, "Mark Ramm" <mark.mchristen...@gmail.com> wrote:
> I'll probably be able to take a look at this later this evening (after
> work and other commitments).
>
> If you could send me a tar or zip of the non-working test code that
> will help a lot. (Feel free to e-mail me directly if you don't want
> your code on-list.)
>
> --Mark
>

Mark Ramm

unread,
Jun 6, 2007, 8:16:01 AM6/6/07
to tgb...@googlegroups.com
Yea, Kid changed the default for HTML tage from upper to lower in
December, and when we picked up the newest version of Kid for the 1.0
release, that broke the tests from the book ;(

--Mark

Reply all
Reply to author
Forward
0 new messages