fix: ensure generated conftest.py located in generated pytest folder

This commit is contained in:
debugtalk
2020-06-06 22:13:59 +08:00
parent e2703fff32
commit d29941124d
6 changed files with 74 additions and 70 deletions

View File

@@ -153,9 +153,7 @@ class TestCompat(unittest.TestCase):
compat.ensure_cli_args(args2),
["examples/postman-echo/request.methods/hardcode.yml"],
)
self.assertTrue(
os.path.isfile("examples/postman_echo/request_methods/conftest.py")
)
self.assertTrue(os.path.isfile("examples/postman_echo/conftest.py"))
args3 = [
"examples/postman-echo/request.methods/hardcode.yml",

View File

@@ -8,7 +8,6 @@ from httprunner.make import (
make_config_chain_style,
make_teststep_chain_style,
pytest_files_run_set,
ensure_file_path_valid,
)
@@ -67,34 +66,6 @@ from examples.postman_echo.request_methods.request_with_functions_test import (
testcase_python_list,
)
def test_ensure_file_path_valid(self):
self.assertEqual(
ensure_file_path_valid(
"examples/postman-echo/request.methods/hardcode.yml"
),
os.path.join(
os.getcwd(), "examples/postman_echo/request_methods/hardcode.yml"
),
)
self.assertEqual(
ensure_file_path_valid(
os.path.join(os.getcwd(), "postman-echo/request.methods/hardcode.yml")
),
os.path.join(os.getcwd(), "postman_echo/request_methods/hardcode.yml"),
)
self.assertEqual(
ensure_file_path_valid(
"examples/postman echo/request methods/hardcode.yml"
),
os.path.join(
os.getcwd(), "examples/postman_echo/request_methods/hardcode.yml"
),
)
self.assertEqual(
ensure_file_path_valid("1/2B/3.yml"),
os.path.join(os.getcwd(), "T1/T2B/T3.yml"),
)
def test_convert_testcase_path(self):
self.assertEqual(
convert_testcase_path("mubu.login.yml"),

View File

@@ -2,6 +2,7 @@ import os
import unittest
from httprunner import loader, utils
from httprunner.utils import ensure_file_path_valid
class TestUtils(unittest.TestCase):
@@ -97,3 +98,31 @@ class TestUtils(unittest.TestCase):
),
["A", "D", "C", "B"],
)
def test_ensure_file_path_valid(self):
self.assertEqual(
ensure_file_path_valid(
"examples/postman-echo/request.methods/hardcode.yml"
),
os.path.join(
os.getcwd(), "examples/postman_echo/request_methods/hardcode.yml"
),
)
self.assertEqual(
ensure_file_path_valid(
os.path.join(os.getcwd(), "postman-echo/request.methods/hardcode.yml")
),
os.path.join(os.getcwd(), "postman_echo/request_methods/hardcode.yml"),
)
self.assertEqual(
ensure_file_path_valid(
"examples/postman echo/request methods/hardcode.yml"
),
os.path.join(
os.getcwd(), "examples/postman_echo/request_methods/hardcode.yml"
),
)
self.assertEqual(
ensure_file_path_valid("1/2B/3.yml"),
os.path.join(os.getcwd(), "T1/T2B/T3.yml"),
)