Skip to content

Strange characters in output, even with colors disabled #35

Open
@juanique

Description

@juanique

I'm writing the output of of my tests to a log file that is visualized on a website. The UI does not support color so I'm running:

pytest ... --color=no > /tmp/test.log

If I cat /tmp/test.log the output looks OK.

self = <path.to.my.TestCase object at 0x7f6650312940>

    def foo(self):
      # ...
    
>       assert bar == {
            "anId": "a53ffeb6-99b0-4a03-8fb3-278c2559efad",
            "anotherId": "9d7a0b13-c92e-45f2-abc4-f260087516a7",
        }
E       AssertionError: assert equals failed
E         {                                                                        {                                                                       
E         -  'anId': 'e7dcba1a-d545-437c-8947-9d901729b51a',                    +  'anId': 'a53ffeb6-99b0-4a03-8fb3-278c2559efad',                   
E         -  'anotherId': '34f4eeab-1f1b-4d41-8421-d87b80000f8f',               +  'anotherId': '9d7a0b13-c92e-45f2-abc4-f260087516a7',             
E         }                                                                        }

There's no colors on the output, which is expected.

But in my Web UI these strange #x00 and #x01 characters appear:

self = <path.to.my.TestCase object at 0x7f6650312940>

    def foo(self):
      # ...
    
>       assert bar == {
            "anId": "a53ffeb6-99b0-4a03-8fb3-278c2559efad",
            "anotherId": "9d7a0b13-c92e-45f2-abc4-f260087516a7",
        }
E       AssertionError: assert equals failed
E         {                                                                        {                                                                       
E         #x00-  'anId': 'e7dcba1a-d545-437c-8947-9d901729b51a',#x01                    #x00+  'anId': 'a53ffeb6-99b0-4a03-8fb3-278c2559efad,#x01
E         #x00-  'anotherId': '34f4eeab-1f1b-4d41-8421-d87b80000f8f',#x01               #x00+  'anotherId': '9d7a0b13-c92e-45f2-abc4-f260087516a7',#x01
E         }   

Also if I cat -A instead of just cat I can see some of these invisible characters, which show up as ^A and ^@

self = <path.to.my.TestCase object at 0x7f6650312940>

    def foo(self):
      # ...
    
>       assert bar == {
            "anId": "a53ffeb6-99b0-4a03-8fb3-278c2559efad",
            "anotherId": "9d7a0b13-c92e-45f2-abc4-f260087516a7",
        }
E       AssertionError: assert equals failed
E         {                                                                        {                                                                       
E         ^@-  'anId': 'e7dcba1a-d545-437c-8947-9d901729b51a',^A                    ^@+  'anId': 'a53ffeb6-99b0-4a03-8fb3-278c2559efad',^A
E         ^@-  'anotherId': '34f4eeab-1f1b-4d41-8421-d87b80000f8f',^A               ^@+  'anotherId': '9d7a0b13-c92e-45f2-abc4-f260087516a7',^A
E         }   

What are these? how can I get rid of them?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions