Giter Site home page Giter Site logo

Comments (4)

dafrose avatar dafrose commented on May 25, 2024

fixed this by introducing a pytest fixture that changes the working directory after a test to what it was before. 494b3e8

from pyrates.

dafrose avatar dafrose commented on May 25, 2024

After further investigation I found that two backend tests where still affected by the change of directory: tests test_1_5_... and test_1_6_... create and change directories many times in a row, leading to somewhat recursive creation of sub-directories, because the numpy backend does not switch back to the original directory after one run. This leads to an error on Windows, because the maximum allowed length of a path is hit (as not indicated by the error message FileNotFoundError). I added the line os.chdir(orig_dir) at the end of the __init__ method of the numpy backend to prevent this. Now all tests are working both on Linux and Windows. Is this solution acceptable? Can the numpy backend also run without changing directories at all?

from pyrates.

Richert avatar Richert commented on May 25, 2024

This solution is acceptable. The NumpyBackend.compile method changes the directory itself during the build process and always used os.chdir(orig_dir) as a last step. Since I never used the frontend in isolation, I apparently forgot to account for the case that the __init__ of the NumpyBackend is called, but not the compile method. Which I suppose causes the problems on Windows.

Theoretically, we could also change the numpy backend to not change directories at all. However, this would require to create build paths with init files along the way, such that they are recognized as proper python modules. In other words, more temporary files would be created.

from pyrates.

dafrose avatar dafrose commented on May 25, 2024

Ok, closing now. Diagnosis shows that some tests still exit with a changed working directory, but the pytest fixture in conftest.py reverts to the original one. Btw., I also added a fixture that makes sure, tests are run in the tests/ folder and not in the parent folder (which travis CI does by default and which caused other problems.)

from pyrates.

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.