Giter Site home page Giter Site logo

Comments (10)

klieret avatar klieret commented on June 2, 2024 1

Switching to pytest solved things! Not sure if it was a change on the way, or just your recommendation of tmp_path, but it's working now :D

from ankipandas.

klieret avatar klieret commented on June 2, 2024

example

from ankipandas.

exc4l avatar exc4l commented on June 2, 2024

Yes, locally I also get a permission error.

from ankipandas.

exc4l avatar exc4l commented on June 2, 2024

col.notes.add_tag seems to be the culprit. I only focused on one of the tests. Might be that the dataframe manipulation causes somekind of os.cwd to be in the directory which could result in this error.

And tempfile causing permissions errors under windows does also seem to be quite the common report.
https://bugs.python.org/issue35144

from ankipandas.

exc4l avatar exc4l commented on June 2, 2024

Btw since you are already using pytest. Any reason to not use the tmp_path provided by pytest?
https://docs.pytest.org/en/stable/tmpdir.html#base-temporary-directory

from ankipandas.

klieret avatar klieret commented on June 2, 2024

Btw since you are already using pytest. Any reason to not use the tmp_path provided by pytest?
https://docs.pytest.org/en/stable/tmpdir.html#base-temporary-directory

Yeah, back then I was still mostly using the unittest framework. Would do a lot of things differently. But perhaps it's worth to try out if using the pytest fixtures handles this better.

from ankipandas.

klieret avatar klieret commented on June 2, 2024

col.notes.add_tag seems to be the culprit.

Ah, I don't think so, because that also happens if you simply read and write the same collection. I think this really is a more fundamental issue about reading and writing files (and perhaps not closing them at some point?)

from ankipandas.

exc4l avatar exc4l commented on June 2, 2024

pytest provides tmpdir and tmp_path.
tmp_path is already a pathlib object.
i.e.

def test_tmp(tmp_path):
    (tmp_path/ "sub").mkdir()

works and you would save the casting.

@klieret

from ankipandas.

klieret avatar klieret commented on June 2, 2024

oh, nice :) Thanks!

from ankipandas.

klieret avatar klieret commented on June 2, 2024

though I saw some issues with that in py3.5 that still require usage of str: pytest-dev/pytest#5017

But probably we can/should drop py3.5 support at some point soon anyway

from ankipandas.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.