Skip to content

Commit cdda7c4

Browse files
committed
fix conanws folder (conan-io#18352)
1 parent 6c77042 commit cdda7c4

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

conan/api/subapi/workspace.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,8 @@ def _find_ws_folder():
2525
path = Path(os.getcwd())
2626
while path.is_dir() and len(path.parts) > 1: # finish at '/' or 'conanws/'
2727
if path.name == WORKSPACE_FOLDER:
28-
if not (path / WORKSPACE_YML).is_file() and not (path / WORKSPACE_PY).is_file():
29-
raise ConanException("Within the 'conanws/' folder, there should be at least one of "
30-
f"these files: {WORKSPACE_YML} and/or {WORKSPACE_PY}")
31-
return str(path)
28+
if (path / WORKSPACE_YML).is_file() or (path / WORKSPACE_PY).is_file():
29+
return str(path)
3230
if (path / WORKSPACE_YML).is_file() or (path / WORKSPACE_PY).is_file():
3331
return str(path)
3432
else:

test/integration/workspace/test_workspace.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ def test_workspace_root(self):
2727
c.save({"conanws/test.txt": ""})
2828
with c.chdir("conanws"):
2929
c.run("workspace root", assert_error=True)
30-
assert ("ERROR: Within the 'conanws/' folder, there should be at least one of these "
31-
"files: conanws.yml and/or conanws.py") in c.out
30+
assert "ERROR: No workspace defined, conanws.py file not found" in c.out
3231
c.save({"conanws.yml": ""})
3332
c.run("workspace root")
3433
assert c.current_folder in c.stdout

0 commit comments

Comments
 (0)