Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a skip statement for an invalid test for the template manager #636

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import unittest
from pathlib import Path

from django.test import TestCase
Expand Down Expand Up @@ -50,6 +51,7 @@ def test_file_export(self):
"""
...

@unittest.skip('TODO: Finish implementing the test for the template manager')
def test_file_imports(self):
"""
Test the control_manager to ensure that its contents are correct for the other tests
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ uri
aiohttp~=3.8
channels
channels-redis
daphne
Pint
django_rq
requests
Expand Down
21 changes: 11 additions & 10 deletions scripts/test_django.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def __parse_command_line(self, *args):
"--quiet, --verbose, and --list are all mutually exclusive. Only call with one.",
file=sys.stderr
)
exit(-1)
sys.exit(-1)


class TestMessage:
Expand Down Expand Up @@ -246,7 +246,7 @@ def __init__(self, path: str, stdout: str, stderr: str, runtime: float):
This will hold the bulk of the data of interest
"""

self.messages: typing.List[TestMessage] = list()
self.messages: typing.List[TestMessage] = []
"""Messages encountered when interpreting stderr"""

self.runtime: float = runtime
Expand Down Expand Up @@ -278,7 +278,7 @@ def __interpret_stdout(self):
print(description, file=sys.stderr)
error_message = TestMessage(
status=self.path,
content=self.stdout,
content=f"{self.stdout}\n\n{self.stderr}",
description=description
)
self.messages.append(error_message)
Expand Down Expand Up @@ -379,7 +379,7 @@ def print(self, verbose: bool = None, quiet: bool = None):
file=sys.stderr
)
# Exit with a code of -1 to indicate that this was an application error, not a test error or failure
exit(-1)
sys.exit(-1)

# We know we're not in verbose mode if it wasn't stated, so set it as False in order to be explicit
if verbose is None:
Expand Down Expand Up @@ -500,7 +500,7 @@ def find_django_applications(root: Path) -> typing.List[Path]:
Returns:
A list of all found testable Django applications
"""
application_paths = list()
application_paths = []

# Indicates if the current root directory might be able to be interpreted
# as a testable Django application
Expand All @@ -513,11 +513,12 @@ def find_django_applications(root: Path) -> typing.List[Path]:
if "__pycache__" in path.parts:
continue
# Anything starting with '.' is considered 'hidden', so we need to skip that
elif path.name.startswith("."):
if path.name.startswith("."):
continue

# If a file named 'manage.py' is found, we might need to check if we're in
# a Django application
elif path.is_file() and path.name == "manage.py":
if path.is_file() and path.name == "manage.py":
has_manage = True
# If the path is a directory, we need to dive deeper to see if a child directory is an application
elif path.is_dir():
Expand Down Expand Up @@ -594,7 +595,7 @@ def run_all_django_tests(django_paths: typing.Sequence[Path]) -> typing.Sequence
Returns:
A collection of test results from every identified Django application
"""
result_data: typing.List[TestOutput] = list()
result_data: typing.List[TestOutput] = []

# If only one path is found, run that naturally
if len(django_paths) == 1:
Expand Down Expand Up @@ -703,12 +704,12 @@ def main() -> int:
verbose=arguments.verbose
)

code += sum([test_result.count for test_result in test_results])
code += sum(test_result.count for test_result in test_results)

return code


if __name__ == "__main__":
# Test all available Django applications and return the number of failed tests
error_count = main()
exit(error_count)
sys.exit(error_count)
Loading