-
Notifications
You must be signed in to change notification settings - Fork 235
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
error when finding pipeline.yaml in root directory #497
Comments
the problem is here: ploomber/src/ploomber/util/default.py Line 467 in 5d88185
there are a bunch of places where we do |
@arturomf94 wanna take this? |
Sorry @idomic - I unfortunately can't atm. Will see if this is still open when I've got a bit more time to contribute! |
@neelasha23 This one is also open! |
Sure! Will take a look |
@edublancas
however, this throws error : I referred this article as well: https://sw0zwl.medium.com/how-to-create-a-directory-in-root-on-catalina-or-big-sur-e58e459461a, but this allows us to create directory at the root and not a file. Any suggestions on how to go about this issue? |
Yeah in mac/linux / is the root, I think it'll be easier for you to mock the location, look on this test: |
@idomic Okay, checking this testcase |
hi @neelasha23, thanks for looking into this. yes, the way to go is to mock the pipeline location. so the error will be raised here: ploomber/src/ploomber/util/default.py Line 467 in 5d88185
we need to mock something like this (not sure if this will actually run), but it'll illustrate the point: from pathlib import Path
from unittest.mock import Mock
from ploomber.util import default
def test_pipeline_yaml_in_root_directory(monkeypatch):
root = Path('/')
mock = Mock(return_value=(root, None))
# mock
monkeypatch.setattr(default, 'find_parent_of_file_recursively', mock)
# now we test
find_root_recursively() monkeypatch reference: https://docs.pytest.org/en/6.2.x/monkeypatch.html This should throw an error because the root directory |
@edublancas @idomic This is the test case that raises IndexError originally:
I can include two other similar test cases for all the 3 places in https://github.com/ploomber/ploomber/blob/master/src/ploomber/util/default.py where Also, in the default.py file just after the
If this doesnt look right I will add try catch block instead as suggested:
|
fixed by #695 |
the recursive function looks at .parent[0] but the root directory does not have a parent
The text was updated successfully, but these errors were encountered: