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
Document basic plugin testing #3121
Comments
That's good in theory but hard to do well. Testing depends on the functionality of the plugin and "what to test" or "how to test it" will vary significantly from plugin to plugin. In my opinion, best documentation for tests is usually (and maybe unfortunately) code. If there are things that could use some explanation... Sure, I'm happy to help. But I can't list them off the top of my head. I don't know what could trip someone, since I've been cursed with knowing too much about
I don't understand what this means. Do you want to test that you're using the correct signal? I honestly don't know how you test that... Do you want to test |
I am aware that there is no general all-in-one solution for this and I might have to read about some pelican internals anyway. But I do not want to become an expert on the pelican internals itself to just use it to test some stuff. Some examples of things I stumbled upon:
For some sort of integration test of the plugin, it might be desirable to run processing of a set of pages, articles etc. as it would be done regularly by pelican to see if my signal usage is correct and leads to the correct results (apart from manually testing this in a project which actually uses the plugin itself). I am aware that I could use an example project for this as well, but maybe there is some mechanism unknown to me which could simplify this. |
Thank you, this is more concrete to expand upon. Some general thoughts... Testing and their supporting functionality that currently exists in For some time, I wanted to overhaul the testing in So, I am sympathetic to the request and would happily welcome any contributions on that regard :).
Well, they are all public in a way. If you're referring to
That's such an open ended question and by necessity requires following it with the questions "deal how?" and "to do what?" :). Again, I'd recommend looking over the tests in
Well, that generally requires running |
Thanks for the further explanations. As already mentioned, this would be nice to have, but I understand that it might be hard to cover the different use cases for plugins. I mostly managed to do what I want and used manual testing in an actual project to verify that everything works as intended, which is sufficient for the small plugins I wrote. There might be an influence regarding documentation on testing from other framework like Django, although pelican serves a completely different purpose with being a static site generator "only".
Yes, I mean the |
Issue
I have written some small pelican plugins in the recent past. To ensure correct behaviour, I added some unit tests as well. This proved to be quite challenging nevertheless, as it basically is undocumented. I managed to get some plain unit tests to work with the help of some other plugins, reading the pelican source code and some trial-and-error. Nevertheless, I limited this to plain method-level tests as testing correct signal handling etc. would be nice, but I wanted to avoid the hassle of further trial-and-error for now.
For this reason I would like to see at least some basic guidance on how to correctly write tests for pelican plugins inside the official docs, as good test coverage generally is desirable.
The text was updated successfully, but these errors were encountered: