-
-
Notifications
You must be signed in to change notification settings - Fork 674
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
Run testbed with Textual in CI #2823
Conversation
4a63acb
to
5b52443
Compare
well, there's something weird is happening with the stub app:
This doesn't happen when I use the system Python:
It's even stranger that it happens for Windows as well.... |
At any rate, if something like this was working, would you be interested in adding it to CI? Or just wait until the test suite can actually run? Or some other middle ground? |
Yes, I'd be interested in seeing this (or a working version of it). While I'd love a full CI test suite, any validation would be better than nothing. Even a basic "will it start" test would have caught the 0.63.2 upgrade issue. As a side note - Textual has unit test support, and that support will allow doing things like changing the screen size. However, I haven't done any investigation into how to make it work, beyond "it exists". My assumption to date has been that we'd need a second app configuration to provide a testbed for textual (and probably a third for web) that is not much more than "from testbed import *", but providing a configuration hook to put the |
Do you have any intuition where this error might be coming from?
As best I can tell, the error text is from If take Briefcase out of the equation, the same thing happens:
Without Debugging the stub app, Python is not exiting with an exception; just a return code of -1. And as best I can tell, the error is occurring before any code in |
Interesting....just throwing spaghetti at the wall at this point... This fails
But this works...
|
I don't - it's clearly a Python error, but I don't get that on macOS; and there's no Windows-specific Python logic in the stub that I can think of...
Yeah - it would be consistent with something trying to do |
That's just it, though...this error is occurring seemingly before any of It looks like the Briefcase args are leaking in to the stub app... |
6227b25
to
72f654b
Compare
Ok; I think figured this out. It has nothing to do with Textual or command line arguments leaking. This is just the error you get if you ask the stub app to run a module that doesn't exist, e.g.:
This was happening for the testbed app because I was passing I think this simulates a similar operation with the Python REPL:
|
Also....first evidence that one second isn't long enough for the DOM storage test I added...
https://github.com/beeware/toga/actions/runs/10767292112/job/29854361006?pr=2823 |
Well that's an interesting manifestation... it's unlikely apps will hit this in the wild, but if we can make it present nicer, we probably should.
Some errors like this are going to be inevitable when we're dependent on network access; unless it becomes a regular fixture in test failures, I'm not overly concerned. |
As for running the testbed app with Textual on macOS in test mode, I'm not sure that Briefcase supports this... Even if I create the helloworld console app and run |
You're right there's no explicit support for Textual in Briefcase. Same goes for Web. Test mode at present is really not much more than "run I have been thinking recently that we may need to rethink how we run testing. This has been mostly driven by the web backend, but it has some possible benefits for other platforms. At present, the test suite runs "in" the app, and reports success via console. That means the app needs to support threads (which Web can't); and it means the state of the test suite gets tied up in the state of the app. An alternate approach would be to do something closer to Playwright/Selenium. The test suite runs as a normal Python test suite, and it opens a "session" to a remote "app" instance. In the case of Playwright, that's a browser session that have been instrumented. You send "remote control" commands to the browser, and poll the browser to query state and evaluate test conditions. This removes the need for any special handling - the test suite is "just" a test suite; it also means your test suite can, if necessary, start multiple apps, allowing you to test startup conditions etc (speed might be an issue for this; but it's not an option at all at present). This would require a pretty radical rework of how Toga does testing... but not that radical, as we've already got the "instrumentation" stuff mostly abstracted. We need to set up an "over the wire" control mechanism, including an in-app server to accept control connections... but that's also something the Toga API is literally designed to make possible. It also solves some big issues we have right now with log streaming - some of our failure modes are currently "macOS/iOS dropped a log message due to load/volume, and now the test suite doesn't know it finished". In the remote-control setup, all testing is a local test suite, so there's no ambiguity. NGL, it would be a big change - but I think it makes Toga's testing story a lot more consistent and stable. |
Yeah; that makes sense. FWIW, if we implemented Textual's current testing support, the app would run in headless mode and there's an object that provides an interface to probe the running app. At least, that's my very cursory review of Textual's testing functionality....so, I'd expect it to be possible to still shoehorn in support for Textual in Toga's current setup if we had to. |
I was thinking, though....we could bring macOS to parity with Windows and Linux for testing console apps by simply streaming the output instead of calling |
Yeah - that's my impression as well - although the entry point for the test might need to be structured a little different. However, that's also compatible with needing a second Briefcase configuration to set up the textual entry point, so it might not be a big deal. |
Agreed that this would be technically possible; the complication with that approach is that app startup is very slightly different when you use |
I'm not sure I follow this entirely; if for only my own edification, how does Are we expecting that For context, I was thinking that installed console apps would just be in |
It doesn't - unless you're testing the app. We are using the same code path to run a console app under test as we do any GUI app, specifically so that we can get the streamed output log. I think I misunderstood what you were proposing though - I thought you were proposing replacing the use of I think that makes sense; since there's a now a different stub binary for console apps, the stdout handling never has the system log redirection installed. |
2e88b21
to
94e641b
Compare
The iOS CI failure was a gap in binary package support - I forgot that Toga requires a specific point release of Pillow (9.2.0). I've compiled and published those wheels, and re-run the CI step; looks like it's building now. |
94e641b
to
0ea07f1
Compare
a389194
to
e8a02af
Compare
c7b52a5
to
f379c61
Compare
So, for this, do you think it's necessary right now to introduce a wholly new app definition for Textual? or just stick with the I also need to decide on how to start the app as "headless"...not sure I like my currently hacked-together solution. |
I hadn't thought of using
Two thoughts on this:
|
996757f
to
23eb758
Compare
23eb758
to
3d0e1f6
Compare
Hmm....I think I'm hesitant to over-implement this right now. While adding a "test" flag should be relatively straightforward, I don't feel like I understand what all it should/could be doing...especially since it would only drive functionality on a PoC backend. Additionally, I'm also reluctant to try to automate setting it based on the environment; while that discussion focuses on pytest, there are other ways to run test suites. Sooo, I've just added a hacky flag to the Textual backend itself. I imagine this being replaced once the testing strategy for Textual is more fleshed out. I'm still open to other implementations, though. |
That's fair. As you've noted, Textual is still an experimental backend; the changes here are limited to either the testbed app, or the Textual backend; I can live with that until we get a more substantial textual testbed. |
Changes
Notes
Related
PR Checklist: