From 1249d4d9c1eb4270dbdc24b4d5be8f82779b1f6b Mon Sep 17 00:00:00 2001 From: debugtalk Date: Sat, 7 Mar 2020 23:37:47 +0800 Subject: [PATCH] test: move unittest aside source code --- tests/test_cli.py => httprunner/cli_test.py | 0 tests/test_parser.py => httprunner/parser_test.py | 0 tests/test_utils.py => httprunner/utils_test.py | 12 ++++++++---- 3 files changed, 8 insertions(+), 4 deletions(-) rename tests/test_cli.py => httprunner/cli_test.py (100%) rename tests/test_parser.py => httprunner/parser_test.py (100%) rename tests/test_utils.py => httprunner/utils_test.py (97%) diff --git a/tests/test_cli.py b/httprunner/cli_test.py similarity index 100% rename from tests/test_cli.py rename to httprunner/cli_test.py diff --git a/tests/test_parser.py b/httprunner/parser_test.py similarity index 100% rename from tests/test_parser.py rename to httprunner/parser_test.py diff --git a/tests/test_utils.py b/httprunner/utils_test.py similarity index 97% rename from tests/test_utils.py rename to httprunner/utils_test.py index 6675188f..28d1c751 100644 --- a/tests/test_utils.py +++ b/httprunner/utils_test.py @@ -1,12 +1,12 @@ import io import os import shutil +import unittest from httprunner import exceptions, loader, utils -from tests.base import ApiServerUnittest -class TestUtils(ApiServerUnittest): +class TestUtils(unittest.TestCase): def test_set_os_environ(self): self.assertNotIn("abc", os.environ) @@ -187,14 +187,18 @@ class TestUtils(ApiServerUnittest): self.assertEqual(extended_variables_mapping["var1"], "val1") def test_deepcopy_dict(self): + license_path = os.path.join( + os.path.dirname(os.path.dirname(__file__)), + "LICENSE" + ) data = { 'a': 1, 'b': [2, 4], 'c': lambda x: x+1, - 'd': open('LICENSE'), + 'd': open(license_path), 'f': { 'f1': {'a1': 2}, - 'f2': io.open('LICENSE', 'rb'), + 'f2': io.open(license_path, 'rb'), } } new_data = utils.deepcopy_dict(data)