LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-20-2017, 10:07 PM   #1
dy20082250
Member
 
Registered: Oct 2013
Location: China
Distribution: Fefora 9
Posts: 77

Rep: Reputation: Disabled
plan to implement a nose plugin and look for advice


now i am learning a python test framework ----nose

and i found that when something went wrong, such as "assert 8==9"
the output is ugly like below:

Code:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/Users/wdy/Documents/noselearn/test.py", line 5, in test3
    assert a == 9
AssertionError:
    8 = 8

while what i really want to get is something like this:

Code:
in /Users/wdy/Documents/noselearn/test.py, [method]  test3 Failed
and the reason is that line 5,  assert 8==9

I googled and get some idea as following:
use nose's API and implement a plugin ,but i am a newbie to nose and its plugin, is there anyone who can give some detailed advice?
 
Old 09-21-2017, 04:40 PM   #2
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1|.2}
Posts: 4,505
Blog Entries: 6

Rep: Reputation: 2421Reputation: 2421Reputation: 2421Reputation: 2421Reputation: 2421Reputation: 2421Reputation: 2421Reputation: 2421Reputation: 2421Reputation: 2421Reputation: 2421
The best advice would be to review the documentation for nose and its API.

I am not familiar with nose myself, but a quick search turns up many references. This looks like a good nose introduction, and includes a separate section for asert_equals and plugins.

Please review these docs and see where additional online searches of related terms leads you, then post back here if you do not understand what you find.

Good luck!
 
Old 09-21-2017, 04:54 PM   #3
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: Slackware
Posts: 7,624

Rep: Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948
Show us your noselearn/test.py file and the command you're using to run the tests.

One or both are wrong.
 
Old 09-22-2017, 04:41 AM   #4
dy20082250
Member
 
Registered: Oct 2013
Location: China
Distribution: Fefora 9
Posts: 77

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by dugan View Post
Show us your noselearn/test.py file and the command you're using to run the tests.

One or both are wrong.

Sorry I don't think so.

the content of test.py is following:

def test():
assert 8==9

and the command that i use to run is:

nosetests --detailled-error test.py

there is nothing special ,the Traceback info that show on stdout is coming from python interpreter
what i want to do is filter the Traceback and only keep some information that are meaningful to the testcase itself.
 
Old 09-22-2017, 04:45 AM   #5
dy20082250
Member
 
Registered: Oct 2013
Location: China
Distribution: Fefora 9
Posts: 77

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by astrogeek View Post
The best advice would be to review the documentation for nose and its API.

I am not familiar with nose myself, but a quick search turns up many references. This looks like a good nose introduction, and includes a separate section for asert_equals and plugins.

Please review these docs and see where additional online searches of related terms leads you, then post back here if you do not understand what you find.

Good luck!
Thanks for your reply

I am reading the nose API document and I think if there is some similar plugin would help me quickly to get to know how to start

all beginning are hard!
 
Old 09-22-2017, 01:05 PM   #6
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: Slackware
Posts: 7,624

Rep: Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948
I stand corrected. Your test file and command are fine.
 
  


Reply

Tags
plugin, python


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
knotify - what is it, and why is it getting up my nose? vasudevadas Linux - Software 5 03-11-2014 01:33 AM
Affordable File Server Backup Plan (via SATA drive taken off-site) any advice? robbmac Linux - Software 2 03-08-2010 11:51 PM
Media plugin advice for firefox coffeedrinker Slackware 9 10-07-2005 11:27 PM
Gates Nose-Dives at CES Genesee General 3 01-06-2005 11:21 AM
Gimp-2 nose dive Johng Linux - Software 0 11-29-2004 04:27 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration