getslash / slash

The Slash testing infrastructure
https://getslash.github.io/slash
Other
75 stars 38 forks source link

Maintaining .slashrc Behavior When Explicitly Using Loader() #1071

Closed ibenioffParallel closed 1 year ago

ibenioffParallel commented 1 year ago

Hi! My apologies if this isn't the right way to ask this, but I wasn't sure how else to reach out to you about this. Feel free to move this conversation somewhere else if this isn't right.

I'm trying to follow the instructions in the Loading And Running Tests In Code section of Slash's documentation. I have a bunch of Slash tests that use a lot of fixtures and custom plugins that are in my .slashrc file. When I run these tests using the slash run command, all those fixtures and plugins work as expected. However, when I tried running some of these tests programmatically according to the documentation, the tests failed because they couldn't find any of the fixtures they need (at least, that's what the errors seemed to indicate to me, I'm happy to provide more details if you need them). I dug through the Slash code base, and it does look like .slashrc is being loaded in and parsed well before slash run ever gets to invoking the get_runnables() method.

Is there an easy way to achieve the same behavior even when programmatically running tests? Or am I going to dig through the source code and duplicate all the internal logic going on in slash run?