mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-06 15:01:22 +08:00
fix: FileExistsError when specified project name conflicts with existed file
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
- fix: convert har to JSON format testcase
|
- fix: convert har to JSON format testcase
|
||||||
- fix: missing ${var} handling in overriding config variables
|
- fix: missing ${var} handling in overriding config variables
|
||||||
- fix: SyntaxError caused by quote in case of headers."Set-Cookie"
|
- fix: SyntaxError caused by quote in case of headers."Set-Cookie"
|
||||||
|
- fix: FileExistsError when specified project name conflicts with existed file
|
||||||
|
|
||||||
## 3.0.12 (2020-06-14)
|
## 3.0.12 (2020-06-14)
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ def init_parser_scaffold(subparsers):
|
|||||||
def create_scaffold(project_name):
|
def create_scaffold(project_name):
|
||||||
""" create scaffold with specified project name.
|
""" create scaffold with specified project name.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def show_tree(prj_name):
|
def show_tree(prj_name):
|
||||||
try:
|
try:
|
||||||
print(f"\n$ tree {prj_name} -a")
|
print(f"\n$ tree {prj_name} -a")
|
||||||
@@ -29,10 +30,15 @@ def create_scaffold(project_name):
|
|||||||
|
|
||||||
if os.path.isdir(project_name):
|
if os.path.isdir(project_name):
|
||||||
logger.warning(
|
logger.warning(
|
||||||
f"Project {project_name} exists, please specify a new project name."
|
f"Project folder {project_name} exists, please specify a new project name."
|
||||||
)
|
)
|
||||||
show_tree(project_name)
|
show_tree(project_name)
|
||||||
return 1
|
return 1
|
||||||
|
elif os.path.isfile(project_name):
|
||||||
|
logger.warning(
|
||||||
|
f"Project name {project_name} conflicts with existed file, please specify a new one."
|
||||||
|
)
|
||||||
|
return 1
|
||||||
|
|
||||||
logger.info(f"Create new project: {project_name}")
|
logger.info(f"Create new project: {project_name}")
|
||||||
print(f"Project Root Dir: {os.path.join(os.getcwd(), project_name)}\n")
|
print(f"Project Root Dir: {os.path.join(os.getcwd(), project_name)}\n")
|
||||||
|
|||||||
Reference in New Issue
Block a user