Closed Sheila-nk closed 1 year ago
@ev-br @melissawm
I'm unable to figure out why the plugin tests are failing. Some assistance please.
The local_files
path is accurate but the files cannot be found.
@ev-br unfortunately, I am still stuck on this.
The plugin test cases in test_pytest_configuration
seem not to find the local files from the stated file path. I tried using the os.path.abspath()
function to pass the absolute file path which should be something like/home/runner/work/scpdt/scpdt...
on the CI. But it's using the pytester temporary directory instead, thus not being found.
I have not given up though.
I think I will need to specify to the user to define local_resources
if any, otherwise set the config
variable to default DTConfig()
or set local_resources
to an empty dict if other attributes need to be set.
The main thing at this stage IMO is to converge on some way of storing a passing around various bits of configuration. Ideally, tack averything we need to the pytest configuration object, if one exists.
Let me look into this. I know the only way to utilize pytest's Config object is through ini options. But I want to see if we can maintain use of DTConfig instead which IMO is much easier to use.
I tried implementing @melissawm 's solution of using ini options to specify local_resources
and it works. It feels more robust and less hacky. It also removes the need for global variables and clean-up after tests.
However, the local files cannot be found when running pytest
in the root directory. It only works wherever the files are... locally, this is in the tests directory. I am currently trying to find a solution to this. I would really appreciate your insight. @melissawm @ev-br
FWIW I'd be wary of solutions which work with ini files only or contest.py only
FWIW I'd be wary of solutions which work with ini files only or contest.py only
Well, the previous implementation of copying files to the cwd worked fine but I am unable to perform a proper clean-up without the copied_files
global variable since I can't keep track of copied files and files that didn't need to be copied. I still cannot find a workaround, unfortunately.
Ok, we can probably live with globals then. One question before we declare it done though. Can we attach what we need here to the pytest config object and pass it around?
Can we attach what we need here to the pytest config object and pass it around?
I think the only way that is possible is through cli and ini options. Maybe @melissawm can weigh in on this.
To keep the ball rolling, I think we should merge the working version with global lists etc, only please rename different config
variables. Then we add other features and then consolidate.
As discussed, let's merge this in its current form to keep the ball rolling. Thanks Sheila!
DTConfig
object inconftest.py
withlocal_resources
specified that is passed to instances ofDTChecker
,DTFinder
andDTParser
copy_local_files
function that ensures local files defined by config'slocal_resources
attribute are copied to the cwd where pytest carries out its testspytest_unconfigure
hook to ensure all copied local files are deleted when testing is completecopy_files
autouse fixture to ensure all local files are copied to the temporary directory used bypytester
during self testing