Feedback: testing multiple modules; leftover app.storage artifacts after tests #3649
Replies: 1 comment
-
Thanks for your feedback @nastasie-octavian. We are always happy to hear about experiences with the new
The
You are right. I just created #3663. |
Beta Was this translation helpful? Give feedback.
-
I've been trying out the user fixture over the past few days to add tests to my NiceGUI app and I have some feedback that I'd like to share.
There should be a way/fixture to test multiple modules at the same time
For projects that have multiple modules (e.g. a login module with the login page and other authentication related functions and endpoints, and one or more other modules with other pages and functions), if we want to test the interaction between pages in different modules (e.g. login pages redirects the user to some page in another module after the user logs in, or some page redirects the user to the login page which is in a different module) the
module_under_test()
marker is not enough and the test functions need to have additionalimportlib.reload()
calls for the other modules.I think that it makes sense to add a
modules_under_test()
marker that can take and reload an arbitrary number of modules for testing.Tests should remove the .nicegui directory created during testing after they finish
When a page that is being tested stores some data using
app.storage
and a .nicegui directory with a .json file is created, the directory and the file remain on the filesystem after the test is over. I think that the testing framework should ensure that these are deleted after a test is over.It's a minor issue since
app.reset()
(and henceapp.storage.clear()
) is called before each test so you don't end up with 1000s of .json files, but there's something about leaving transient testing artifacts on disk that's bugging me.Beta Was this translation helpful? Give feedback.
All reactions