Skip to content

Commit 84415b7

Browse files
Merge branch 'main' into add-timing-info-to-generated-tests
2 parents 2bffc7f + 1eb54df commit 84415b7

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

codeflash/cli_cmds/cmd_init.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def collect_setup_info() -> SetupInfo:
211211
# Discover test directory
212212
default_tests_subdir = "tests"
213213
create_for_me_option = f"okay, create a tests{os.pathsep} directory for me!"
214-
test_subdir_options = valid_subdirs
214+
test_subdir_options = [sub_dir for sub_dir in valid_subdirs if sub_dir != module_root]
215215
if "tests" not in valid_subdirs:
216216
test_subdir_options.append(create_for_me_option)
217217
custom_dir_option = "enter a custom directory…"
@@ -240,7 +240,16 @@ def collect_setup_info() -> SetupInfo:
240240
apologize_and_exit()
241241
else:
242242
tests_root = Path(curdir) / Path(cast("str", tests_root_answer))
243+
243244
tests_root = tests_root.relative_to(curdir)
245+
246+
resolved_module_root = (Path(curdir) / Path(module_root)).resolve()
247+
resolved_tests_root = (Path(curdir) / Path(tests_root)).resolve()
248+
if resolved_module_root == resolved_tests_root:
249+
logger.warning(
250+
"It looks like your tests root is the same as your module root. This is not recommended and can lead to unexpected behavior."
251+
)
252+
244253
ph("cli-tests-root-provided")
245254

246255
# Autodiscover test framework

0 commit comments

Comments
 (0)