-
-
Notifications
You must be signed in to change notification settings - Fork 798
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
Start documentation chapter for plugin tests #8616
Conversation
✅ Deploy Preview for inventree-web-pui-preview ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just additionally it would be good to also give the hint to set the following env variables while testing. Then the plugins automatically get added and activated for testing:
INVENTREE_PLUGINS_ENABLED: True
INVENTREE_PLUGIN_TESTING: True
INVENTREE_PLUGIN_TESTING_SETUP: True
Plugins can be installed via pip3 install -e path/to/my/plugin
. Then invoke migrate
needs to run (if the plugin adds migrations using the app mixin). And then tests can be run with coverage run --omit="InvenTree/**" InvenTree/manage.py test inventree_bulk_plugin.tests.integration
. This also creates coverage reports which later can be viewed via coverage html
or coverage report --format=markdown
.
That's what I was missing. My plugin does not show up in the resistry without the variables. Setting INVENTREE_PLUGINS_ENABLED solves that. I have plugins_enabled: True in the config file. But this does not seem to be used. |
Format looks ugly... |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #8616 +/- ##
=======================================
Coverage 84.68% 84.68%
=======================================
Files 1190 1190
Lines 54296 54296
Branches 2055 2055
=======================================
+ Hits 45980 45981 +1
+ Misses 7796 7795 -1
Partials 520 520
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Looks better now. |
but I'm not entirely sure about the difference between the last two. And then there is also |
Thanks. I added your comments. I think we can publish it for the moment and add details as soon as we have them. |
docs/docs/extend/plugins/test.md
Outdated
--- | ||
|
||
## Unit Tests | ||
For complicated plugins it makes sense to add unit tests to your code. InvenTree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add something like "to ensure that plugins work correctly and are compatible with future versions too. You can run these tests as part of your ci against the current stable and latest tag to get notified when something breaks before it gets released as part of stable"???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better text :-) thanks.
I think we are done with this.
In the "do some work here" I think it would be a good idea to have some examples of what testing might actually be performed |
Definitely... |
Lets start from here. I will continue as soon as I have something working...