python-gitlab / python-gitlab

A python wrapper for the GitLab API.

Home Page:https://python-gitlab.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong type on `job.trace()`?

stdedos opened this issue Β· comments

if TYPE_CHECKING:
assert isinstance(return_value, dict)
return return_value

In [3]: type(job.trace())
Out[3]: bytes

This might be the case, as we were probably applying typing across dozens of endpoints at the time.

If we consistently get bytes regardless of the streamed argument we can change that easily.

Oh ... Haven't tried the streamed= πŸ˜…

Then, at least | bytes is also needed?

Actually ... even worse? πŸ˜… πŸ˜…

In [4]: a = job.trace(streamed=True)
b'\x1b[0KRunning with gitlab-runner ...ERROR: Job failed: command terminated with exit code 1\n\x1b[0;m\n'

In [5]: repr(a)
Out[5]: 'None'

Have I messed up something? I am pretty sure that there's no excuse for a "blanket" print to the terminal πŸ˜•

Full disclosure, I'm running against 15.10.2-ee - but I don't think that that should affect

Would you kindly check from your end?

So when using streamed=True it will by default just print() the data. If that is not desired, then the action argument must specify a function to call that accepts the streamed data.