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

Start documentation chapter for plugin tests #8616

Closed
wants to merge 9 commits into from

Conversation

SergeoLacruz
Copy link
Contributor

Lets start from here. I will continue as soon as I have something working...

Copy link

netlify bot commented Dec 2, 2024

Deploy Preview for inventree-web-pui-preview ready!

Name Link
🔨 Latest commit 84c608d
🔍 Latest deploy log https://app.netlify.com/sites/inventree-web-pui-preview/deploys/67501c58ce865d0008e1be43
😎 Deploy Preview https://deploy-preview-8616--inventree-web-pui-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 100 (no change from production)
Accessibility: 86 (no change from production)
Best Practices: 100 (no change from production)
SEO: 78 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@SchrodingersGat SchrodingersGat added this to the 1.0.0 milestone Dec 2, 2024
Copy link
Contributor

@wolflu05 wolflu05 left a 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.

@SergeoLacruz
Copy link
Contributor Author

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.
I think we should add more details regarding the variables. The first one is clear. The other ones need more explanation.

@SergeoLacruz
Copy link
Contributor Author

Format looks ugly...
Will fix tomorrow
Good night :-)

Copy link

codecov bot commented Dec 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.68%. Comparing base (1a8b030) to head (a0e7ea8).

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           
Flag Coverage Δ
backend 86.06% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@SergeoLacruz
Copy link
Contributor Author

Looks better now.

@wolflu05
Copy link
Contributor

wolflu05 commented Dec 3, 2024

  • INVENTREE_PLUGINS_ENABLED: True just enables the use of 3rd party plugins
  • INVENTREE_PLUGIN_TESTING: True enables all plugins no matter of their active state in the db or built-in flag
  • INVENTREE_PLUGIN_TESTING_SETUP: True enables the url mixin and probably some other things

but I'm not entirely sure about the difference between the last two. And then there is also INVENTREE_PLUGIN_TESTING_EVENTS and INVENTEE_PLUGIN_TESTING_EVENTS_ASYNC to enable testing for events, but I have not used them.

@SergeoLacruz
Copy link
Contributor Author

Thanks. I added your comments. I think we can publish it for the moment and add details as soon as we have them.

---

## Unit Tests
For complicated plugins it makes sense to add unit tests to your code. InvenTree
Copy link
Contributor

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"???

Copy link
Contributor Author

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.

@SchrodingersGat
Copy link
Member

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

@SergeoLacruz
Copy link
Contributor Author

Definitely...
But that's the next chapter :-)

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

Successfully merging this pull request may close these issues.

3 participants