py.test munging strings in asserts?

2006-04-20 Thread Timothy Grant
I'm playing around with py.test and writing a parser for it's output
for use in TextMate.

I've run into what appears to be a strange phenomenon, but which is
likely me doing something wrong.

I'm writing a test to test some HTML output and the test fails for
several reasons, all of which I understand but one.

Here's the output (I've surrounded the problem area with *** to make
it a little more visible.


def test_error_summary():
text = '''


PyTestMate


.error {color : #FF}




Error in /Users/tjg/code/textmate/test_pytestmate.py
at line 17

[/Users/tjg/code/textmate/test_pytestmate.py:17]


'''

assert pytestmate.create_output(
['[/Users/tjg/code/textmate/test_pytestmate.py:17]']
E   ) == text
>   assert '\n\n content="text/html; charset=utf-8" 
> />\nPyTestMate\n\n***<...mate/test_pytestmate.py*** at 
> line 
> 17[/Users/tjg/code/textmate/test_pytestmate.py:17]\n'
>  == '\n\n />\nPyTestMate\n\n***<...st_pytestmate.py*** at line 
> 17\n\n[/Users/tjg/code/textmate/test_pytestmate.py:17]\n\n\n'
 +  where '\n\n\nPyTestMate\n\n<...mate/test_pytestmate.py at
line 
17[/Users/tjg/code/textmate/test_pytestmate.py:17]\n'
= (['[/Users/tjg/code/textmate/test_pytestmate.py:17]'])
 +where  =
pytestmate.create_output

[/Users/tjg/code/textmate/test_pytestmate.py:55]
===

granted the left side of that equality could be messed up due to
create_output() NOT doing the right thing. But the right side is
simply the contents of the variable "text" so WHY is the first part of
the path being substituted with "..."?

Any insight greatly appreciated.

--
Stand Fast,
tjg.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: py.test munging strings in asserts?

2006-04-21 Thread Johnny deBris
Timothy Grant wrote:
> 
> granted the left side of that equality could be messed up due to
> create_output() NOT doing the right thing. But the right side is
> simply the contents of the variable "text" so WHY is the first part of
> the path being substituted with "..."?
> 
Some grepping on '...' revealed that there's some string munging going
on in py/code/safe_repr.py, In py/test/terminal/terminal.py, in
TerminalSession, there's a method 'repr_locals' that uses it, I guess
you have to override that or something if you want to change this
behaviour...

Cheers,

Guido Wesdorp
-- 
http://mail.python.org/mailman/listinfo/python-list