mirror of https://github.com/zulip/zulip.git
Rename tools/lib/api_tests.py to zerver/lib/api_test_helpers.py.
Now that the Markdown extension defined in zerver/lib/bugdown/api_generate_examples depended on code in the tools/lib/* directory, it caused the production tests to fail since the tools/ directory wouldn't exist in a production environment.
This commit is contained in:
parent
a1a69a0ac2
commit
c158869096
|
@ -14,7 +14,7 @@ os.chdir(ZULIP_PATH)
|
|||
from zulip import Client
|
||||
|
||||
from tools.lib.test_server import test_server_running
|
||||
from tools.lib.api_tests import test_the_api
|
||||
from zerver.lib.api_test_helpers import test_the_api
|
||||
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'zproject.test_settings'
|
||||
django.setup()
|
||||
|
|
|
@ -107,6 +107,7 @@ not_yet_fully_covered = {
|
|||
'zerver/lib/statistics.py',
|
||||
'zerver/lib/test_fixtures.py',
|
||||
'zerver/lib/test_runner.py',
|
||||
'zerver/lib/api_test_helpers.py',
|
||||
# Webhook integrations with incomplete coverage
|
||||
'zerver/webhooks/basecamp/view.py',
|
||||
'zerver/webhooks/beanstalk/view.py',
|
||||
|
|
|
@ -9,11 +9,7 @@ from markdown.preprocessors import Preprocessor
|
|||
from typing import Any, Dict, Optional, List
|
||||
import markdown
|
||||
|
||||
ZULIP_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
|
||||
TOOLS_DIR = os.path.join(ZULIP_DIR, 'tools', 'lib')
|
||||
sys.path.insert(0, TOOLS_DIR)
|
||||
|
||||
import api_tests
|
||||
import zerver.lib.api_test_helpers
|
||||
|
||||
REGEXP = re.compile(r'\{generate_code_example\|\s*(.+?)\s*\|\s*(.+?)\s*\}')
|
||||
|
||||
|
@ -72,7 +68,7 @@ class APICodeExamplesPreprocessor(Preprocessor):
|
|||
def render_fixture(self, function: str) -> List[str]:
|
||||
fixture = []
|
||||
|
||||
fixture_dict = api_tests.FIXTURES[function]
|
||||
fixture_dict = zerver.lib.api_test_helpers.FIXTURES[function]
|
||||
fixture_json = ujson.dumps(fixture_dict, indent=4, sort_keys=True)
|
||||
|
||||
fixture.append('```')
|
||||
|
@ -82,7 +78,7 @@ class APICodeExamplesPreprocessor(Preprocessor):
|
|||
return fixture
|
||||
|
||||
def render_code_example(self, function: str) -> List[str]:
|
||||
method = api_tests.TEST_FUNCTIONS[function]
|
||||
method = zerver.lib.api_test_helpers.TEST_FUNCTIONS[function]
|
||||
function_source_lines = inspect.getsourcelines(method)[0]
|
||||
ce_regex = re.compile(r'\# \{code_example\|\s*(.+?)\s*\}')
|
||||
|
||||
|
|
Loading…
Reference in New Issue