-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG]: getDeployDirectory returns #31
Comments
RobotPy uses its own implementation of I tried this on Linux using |
I ran more experiments, it looks like it changes based on how I launch. I created a single testcase and tried running it a few ways, observing the file it put to disk and the contents of that file.
If I do the same experiment you ran, it is correct. The results I had were from launching my test suite under vsCode's python debug environment:
In this case, the I get similarly wonky results when using an extension for running pytest, and clicking "run" next to the single testcase: c:\Users\chris.vscode\extensions\ms-python.python-2023.20.0\pythonFiles\vscode_pytest\deploy However, this also does not run the test in the Looks like vsCode's debug environment or extentions is both messing with where |
maximal reproducible example here from my experiments: https://github.com/RobotCasserole1736/firstRoboPy/tree/chris_test_deployDir |
The only supported way to run pytest tests on RobotPy code is via When running We could work around this at https://github.com/robotpy/pyfrc/blob/main/pyfrc/mains/cli_test.py#L75 by adding the following: # In some cases __main__.__file__ is not an absolute path, and some
# internals depend on that being correct. Set it up before we change
# directories
sys.modules["__main__"].__file__ = abspath(sys.modules["__main__"].__file__) But I'm not particularly happy about that solution. Open to other ideas? |
This should be fixed in the kickoff release due to changes in how the robot code is launched. |
Problem description
wpilib.getDeployDirectory()
is returningtests\deploy
for the deploy directory, rather than justdeploy
. It looks like the underlying wpilib implementation doesn't account for the fact that the working directory for tests is not the same folder asrobot.py
?Currently, we're using pathplanner to store
.path
files in the deploy directory. However, when running the test suite, the code that works on the robot fails due to the extratest
in the path.I think that, at least, during tests, the python implementation might need to be unique to make sure it points back at the correct folder, regardless of where the code is running from.
Operating System
Windows
Installed Python Packages
Reproducible example code
The text was updated successfully, but these errors were encountered: