@@ -203,25 +203,24 @@ def process_pyproject_config(args: Namespace) -> Namespace:
203203 assert path_obj .exists (), f"ignore-paths config must be a valid path. Path { path } does not exist"
204204 normalized_ignore_paths .append (path_obj .resolve ())
205205 args .ignore_paths = normalized_ignore_paths
206- # Project root path is one level above the specified directory, because that's where the module can be imported from
207206 args .module_root = Path (args .module_root ).resolve ()
208207 # If module-root is "." then all imports are relatives to it.
209208 # in this case, the ".." becomes outside project scope, causing issues with un-importable paths
210- args .project_root = project_root_from_module_root (args .module_root , pyproject_file_path )
209+ root = project_root_from_pyproject_file (pyproject_file_path )
210+ args .project_root = root
211211 args .tests_root = Path (args .tests_root ).resolve ()
212212 if args .benchmarks_root :
213213 args .benchmarks_root = Path (args .benchmarks_root ).resolve ()
214- args .test_project_root = project_root_from_module_root ( args . tests_root , pyproject_file_path )
214+ args .test_project_root = root
215215 if is_LSP_enabled ():
216216 args .all = None
217217 return args
218218 return handle_optimize_all_arg_parsing (args )
219219
220220
221- def project_root_from_module_root (module_root : Path , pyproject_file_path : Path ) -> Path :
222- if pyproject_file_path .parent == module_root :
223- return module_root
224- return module_root .parent .resolve ()
221+ def project_root_from_pyproject_file (pyproject_file_path : Path ) -> Path :
222+ """Assume that the pyproject.toml file is in the root of the project."""
223+ return pyproject_file_path .parent
225224
226225
227226def handle_optimize_all_arg_parsing (args : Namespace ) -> Namespace :
0 commit comments