scipy / scipy_doctest

Floating-point aware doctesting
BSD 3-Clause "New" or "Revised" License
5 stars 4 forks source link

Copy local files to current working directory #85

Closed Sheila-nk closed 1 year ago

Sheila-nk commented 1 year ago
Sheila-nk commented 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.

Sheila-nk commented 1 year ago

@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.

Sheila-nk commented 1 year ago

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.

Sheila-nk commented 1 year ago

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.

Sheila-nk commented 1 year ago

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

ev-br commented 1 year ago

FWIW I'd be wary of solutions which work with ini files only or contest.py only

Sheila-nk commented 1 year ago

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.

ev-br commented 1 year ago

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?

Sheila-nk commented 1 year ago

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.

ev-br commented 1 year ago

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.

ev-br commented 1 year ago

As discussed, let's merge this in its current form to keep the ball rolling. Thanks Sheila!