diff --git a/edgedb/codegen/generator.py b/edgedb/codegen/generator.py index e824bbbb..359dd034 100644 --- a/edgedb/codegen/generator.py +++ b/edgedb/codegen/generator.py @@ -126,9 +126,7 @@ def __init__(self, args: argparse.Namespace): self._skip_pydantic_validation = args.skip_pydantic_validation self._async = False try: - self._project_dir = pathlib.Path( - find_edgedb_project_dir() - ).resolve() + self._project_dir = pathlib.Path(find_edgedb_project_dir()) except edgedb.ClientConnectionError: print( "Cannot find edgedb.toml: " @@ -175,7 +173,6 @@ def run(self): def _process_dir(self, dir_: pathlib.Path): for file_or_dir in dir_.iterdir(): - file_or_dir = file_or_dir.resolve() if not file_or_dir.exists(): continue if file_or_dir.is_dir(): diff --git a/tests/codegen/linked/test_linked.edgeql b/tests/codegen/linked/test_linked.edgeql new file mode 100644 index 00000000..78a9b08b --- /dev/null +++ b/tests/codegen/linked/test_linked.edgeql @@ -0,0 +1 @@ +select 42 diff --git a/tests/codegen/linked/test_linked_async_edgeql.py.assert b/tests/codegen/linked/test_linked_async_edgeql.py.assert new file mode 100644 index 00000000..29c6291b --- /dev/null +++ b/tests/codegen/linked/test_linked_async_edgeql.py.assert @@ -0,0 +1,16 @@ +# AUTOGENERATED FROM 'linked/test_linked.edgeql' WITH: +# $ edgedb-py + + +from __future__ import annotations +import edgedb + + +async def test_linked( + client: edgedb.AsyncIOClient, +) -> int: + return await client.query_single( + """\ + select 42\ + """, + ) diff --git a/tests/codegen/linked/test_linked_edgeql.py.assert b/tests/codegen/linked/test_linked_edgeql.py.assert new file mode 100644 index 00000000..2c3c0410 --- /dev/null +++ b/tests/codegen/linked/test_linked_edgeql.py.assert @@ -0,0 +1,16 @@ +# AUTOGENERATED FROM 'linked/test_linked.edgeql' WITH: +# $ edgedb-py --target blocking --no-skip-pydantic-validation + + +from __future__ import annotations +import edgedb + + +def test_linked( + client: edgedb.Client, +) -> int: + return client.query_single( + """\ + select 42\ + """, + ) diff --git a/tests/codegen/test-project1/generated_async_edgeql.py.assert b/tests/codegen/test-project1/generated_async_edgeql.py.assert index 876c5f0c..d35b5528 100644 --- a/tests/codegen/test-project1/generated_async_edgeql.py.assert +++ b/tests/codegen/test-project1/generated_async_edgeql.py.assert @@ -1,6 +1,7 @@ # AUTOGENERATED FROM: # 'select_optional_json.edgeql' # 'select_scalar.edgeql' +# 'linked/test_linked.edgeql' # WITH: # $ edgedb-py --target async --file --no-skip-pydantic-validation @@ -46,3 +47,13 @@ async def select_scalar( select 1;\ """, ) + + +async def test_linked( + client: edgedb.AsyncIOClient, +) -> int: + return await client.query_single( + """\ + select 42\ + """, + ) diff --git a/tests/codegen/test-project1/linked b/tests/codegen/test-project1/linked new file mode 120000 index 00000000..4433438d --- /dev/null +++ b/tests/codegen/test-project1/linked @@ -0,0 +1 @@ +../linked/ \ No newline at end of file