Cobular / distest

A library used to do integration testing on discord bots
MIT License
29 stars 8 forks source link

Pytest plugin? #43

Open stephend017 opened 3 years ago

stephend017 commented 3 years ago

I just stumbled upon this project and it looks really cool and exactly what I need but I use pytest to write my tests. This is a very common testing tool and provides a lot of functionality out of the box that could help simplify some development here.

Making this project a plugin would make it easier for others to use and help take this project to the next level. This would require some modification of the project or potentially a different project that acts as a wrapper for this one. I'm happy to help if you decide to go in this direction.

Cobular commented 3 years ago

I've been aware of pytest for a while, but thought it would be way too much work to implement support for at the moment. However, I didn't know about that plugin framework, which looks really promising! I'll definitely take a look at it soon, but can't really promise a timeframe since school munching too much time. Thanks for pointing this out about this.

I'm not sure how much experience you have with pytest plugin development, possibly more than my none, but from skimming that page, it seems like we could make something that iterates over all the tests that are available and registers them as pytest tests, and then maybe use like conditional imports in the exceptions, since everything always throws one of a few custom exceptions, to trigger the assertion failures. I'm not totally sure how to load in setup and teardown stuff, it might have been that part about hooks but that didn't seem super relevant, either way this totally seems doable!

Regarding your contribution, I'd really appreciate that. I'd like to come up with a solid plan together before you start doing a lot with it, if you actually want to, so we can be on the same page as to how it will work and how that might impact the library's design. Could you join the discord? I think it's linked in the readme.

stephend017 commented 3 years ago

I have a general idea of how we might implement it. Mainly through using the plugin to load the tokens as config variables to pytest then using a fixture (which is pytests built in dependency injection) to expose the testing API you've built so far.

I will also join the discord and we can talk more there.

Cobular commented 3 years ago

Hey @stephend017 I have a bit of time rn and I saw someone on the discord was interesting in helping with this too, did you ever join and if so what's your username?

stephend017 commented 3 years ago

Hey sorry for the delayed response, I've been busy with school. I joined the discord a while back but ended up leaving for a combination of things. 1. it was kinda stale. but more importantly 2. Now that I have a clearer picture of what this is used to test I realized that I personally don't have a need for it. Maybe I'll come back in a few months once school is over but for now all I can do is wish you good luck with it.