Skip to content

Strange characters in output, even with colors disabled #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
juanique opened this issue Feb 27, 2023 · 0 comments
Open

Strange characters in output, even with colors disabled #35

juanique opened this issue Feb 27, 2023 · 0 comments

Comments

@juanique
Copy link

juanique commented Feb 27, 2023

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant