@@ -94,9 +94,11 @@ def with_mocked_version_command(mocker: MockerFixture) -> None:
9494
9595 def mock_handle (command : VersionCommand ) -> int :
9696 exit_code = orig_version_command (command )
97+ application = command .application
98+ assert isinstance (application , Application )
9799
98100 command .io .write_line (f"ProjectPath: { command .poetry .pyproject_path .parent } " )
99- command .io .write_line (f"WorkingDirectory: { Path . cwd () } " )
101+ command .io .write_line (f"WorkingDirectory: { application . working_directory } " )
100102
101103 return exit_code
102104
@@ -226,6 +228,28 @@ def test_application_with_relative_project_parameter(
226228 """ )
227229
228230
231+ def test_application_with_relative_directory_parameter (
232+ tester : ApplicationTester ,
233+ project_source_directory : Path ,
234+ relative_project_source_directory : Path ,
235+ with_mocked_version_command : None ,
236+ ) -> None :
237+ args = f"--directory '{ relative_project_source_directory } ' version"
238+
239+ tester .execute (args )
240+ assert tester .io .fetch_error () == ""
241+ assert tester .status_code == 0
242+
243+ output = tester .io .fetch_output ()
244+
245+ # relative directory parameter results in absolute path for working directory
246+ assert output == textwrap .dedent (f"""\
247+ foobar 0.1.0
248+ ProjectPath: { project_source_directory }
249+ WorkingDirectory: { project_source_directory }
250+ """ )
251+
252+
229253def test_application_with_relative_directory_parameter_and_early_poetry_access_plugin (
230254 tester : ApplicationTester ,
231255 with_early_poetry_access_plugin : None ,
0 commit comments