Skip to content

Commit

Permalink
Merge pull request #126 from gregoil/add_server_entrypoint
Browse files Browse the repository at this point in the history
added server entrypoint, travis, django.setup
  • Loading branch information
osherdp committed Jan 14, 2019
2 parents ae9113a + 998c649 commit 122c49e
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 13 deletions.
5 changes: 0 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ jobs:
python: '3.6'
install: pip install tox
script: tox -e docs
- name: validate requirements
stage: test
python: '2.7'
install: pip install tox
script: tox -e validate_requirements
- stage: deploy
python: '3.6'
install: skip
Expand Down
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ pathlib2==2.3.3
pbr==5.1.1
pexpect==4.6.0
pickleshare==0.7.5
pluggy==0.8.0
pluggy==0.8.1
prompt-toolkit==1.0.15
psutil==5.4.8
ptyprocess==0.6.0
py==1.7.0
pycodestyle==2.4.0
pyfakefs==3.5.5
pyfakefs==3.5.6
pyflakes==2.0.0
Pygments==2.3.1
pylint==1.9.4
pytest==4.1.0
pytest==4.1.1
pytest-cov==2.6.1
pytest-django==3.4.5
PyYAML==3.13
Expand All @@ -57,6 +57,6 @@ termcolor==1.1.0
traitlets==4.3.2
urllib3==1.24.1
wcwidth==0.1.7
wrapt==1.10.11
wrapt==1.11.0
xlrd==1.2.0
xlwt==1.3.0
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from setuptools import setup, find_packages


__version__ = "5.4.2"
__version__ = "5.5.0"

result_handlers = [
"db = rotest.core.result.handlers.db_handler:DBHandler",
Expand Down Expand Up @@ -70,6 +70,7 @@
"rotest.result_handlers": result_handlers,
"rotest.cli_client_parsers": [],
"rotest.cli_client_actions": [],
"rotest.cli_server_actions": [],
},
packages=find_packages("src"),
package_dir={"": "src"},
Expand Down
2 changes: 1 addition & 1 deletion src/rotest/cli/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def create_client_options_parser():

for entry_point in \
pkg_resources.iter_entry_points("rotest.cli_client_parsers"):
core_log.debug("Applying entry point %s", entry_point.name)
core_log.debug("Applying client entry point %s", entry_point.name)
extension_parser = entry_point.load()
extension_parser(parser)

Expand Down
11 changes: 11 additions & 0 deletions src/rotest/cli/server.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
from __future__ import absolute_import

import pkg_resources
import django
from django.core.management import call_command

from rotest.common import core_log
from rotest.common.config import DJANGO_MANAGER_PORT
from rotest.api.test_control.session_cleaner import run_session_cleaner


def start_server():
"""Run session manager and Django server according to the config file."""
django.setup()

for entry_point in \
pkg_resources.iter_entry_points("rotest.cli_server_actions"):
core_log.debug("Applying server entry point %s", entry_point.name)
extension_action = entry_point.load()
extension_action()

run_session_cleaner()
call_command("runserver", "0.0.0.0:{}".format(DJANGO_MANAGER_PORT))
1 change: 0 additions & 1 deletion src/rotest/core/result/handlers/abstract_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class AbstractResultHandler(with_metaclass(ABCMeta, object)):
main_test (rotest.core.abstract_test.AbstractTest): the main test
instance (e.g. TestSuite instance or TestFlow instance).
"""

NAME = NotImplemented

def __init__(self, main_test=None, *args, **kwargs):
Expand Down
1 change: 0 additions & 1 deletion src/rotest/management/utils/resources_discoverer.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ def get_resources(app_name, blacklist=DISCOVERER_BLACKLIST):
Returns:
dict. all resource classes found in the application {name: class}.
"""
django.setup()
app_configs = django.apps.apps.app_configs
if app_name not in app_configs:
raise RuntimeError("Application %r was not found" % app_name)
Expand Down

0 comments on commit 122c49e

Please sign in to comment.