Skip to content
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

Tests fail on MacOS #167

Open
jcollins1983 opened this issue Feb 23, 2023 · 5 comments · Fixed by #198
Open

Tests fail on MacOS #167

jcollins1983 opened this issue Feb 23, 2023 · 5 comments · Fixed by #198
Assignees
Labels

Comments

@jcollins1983
Copy link
Collaborator

jcollins1983 commented Feb 23, 2023

The tests fail on MacOS

(and possibly on other *nix systems)

An exception is raised on access to attributes in termios.
image

When running normally, this code does not raise an exception. Not sure why pytest isn't happy with it... yet.

Doesn't appear to be isolated to pytest though... pfalcon/picotui#71

Since there's no usage (that we know of) of fixate on *nix systems, it's probably not worth chasing down, but I wanted to note it.

@clint-lawrence
Copy link
Collaborator

I could be totally off the mark here, but could be a result of stdin/stdout being connected to a pipe rather than terminal

josh-marshall-amp added a commit that referenced this issue Jul 22, 2024
…ose operations fail on a pipe, ie when running pytest. Fix for #167, tests fail on macOS.
@josh-marshall-amp
Copy link
Contributor

Since there's no usage (that we know of) of fixate on *nix systems, it's probably not worth chasing down, but I wanted to note it.

(cough) fix incoming

@jcollins1983
Copy link
Collaborator Author

Not sure this issue should be closed (if we want to support *nix)...
The tests still don't pass on Mac without passing extra parameters to pytest; and doing that makes the output horrible.
tox -e py on mac results in

image

The fix that was implemented will still evaluate the fileno(), os.isatty(sys.stdin.fileno())

Attempting to check if stdin has a fileno attribute instead of the isatty check doesn't appear to make any difference.
elif hasattr(sys.stdin, "fileno"):

printing sys.stdin.__dir__() shows that there is still a fileno attribute, but it looks like pytest checks for access of the fileno method and puts on the brakes. Pretty sure this is confirmed here pytest source code

Also here in the same file:
image

So, I don't think (unless I'm missing something) that it's an easy thing to either check for fileno or isatty.

With a small tweak to the tox.ini to accept posargs for the pytest call,
tox -e py -- -s (tried because of this) and some hints in the pytest code, results in all the stdout going to the terminal (to be expected since that's what it's supposed to do) except the tests pause at this point waiting for something to acknowledge the exception

image

pressing enter allows the tests to continue, I think it's one of the xfail marked tests.
image

image

Ending up with the tests running, and passing

image

Including the tests that I've got in my branch for the fxconfig duplicate prevention. Note: tests not finished yet. The weird thing is that the captures that I'm doing there actually work with -s which should stop all capture if I'm reading the docs correctly.

At this point, I think I'm probably best to do my development and testing on a windows machine, since that's where it really matters for us.

@jcollins1983
Copy link
Collaborator Author

Also, @josh-marshall-amp suggested to me the other day on messenger

Or catch the exception and just continue onward without the saving

Doing this makes the tests run, however my tests that are using pytests capture fixture (capfd at this point, but I get the same (lack of) result with capsys) don't capture anything.
image

So I'm not convinced that this is the solution, it could be part of it though.

@josh-marshall-amp
Copy link
Contributor

josh-marshall-amp commented Aug 2, 2024

Sorry @jcollins1983, missed this response while I was buried in the Important Task. I agree my hack doesn't fix it, I've actually run into the same problem, and I'll come back to this when I get some spare cycles. My motivation here is not just for my own running, but also to make it possible to run the tests in *nix CI. I'll reopen.

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

Successfully merging a pull request may close this issue.

3 participants