Skip to content

Commit

Permalink
make "python setup.py test" work
Browse files Browse the repository at this point in the history
  • Loading branch information
Olek Golovatyi committed Jul 29, 2020
1 parent 8fdf6b0 commit d966774
Show file tree
Hide file tree
Showing 18 changed files with 26 additions and 18 deletions.
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import os
from setuptools import setup, find_packages
import unittest


DOCLINES = (__doc__ or "").split("\n")
Expand Down Expand Up @@ -106,7 +107,7 @@ def read(fname):
"sklearn",
"textblob",
],
test_suite="pytest",
test_suite="tests",
)


Expand Down
2 changes: 1 addition & 1 deletion tabpy/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.0
1.2.0
17 changes: 12 additions & 5 deletions tabpy/tabpy_server/app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class TabPyApp:
python_service = None
credentials = {}

def __init__(self, config_file=None):
def __init__(self, config_file):
if config_file is None:
config_file = os.path.join(
os.path.dirname(__file__), os.path.pardir, "common", "default.conf"
Expand Down Expand Up @@ -243,13 +243,20 @@ def _parse_config(self, config_file):
pkg_path = os.path.dirname(tabpy.__file__)

parser = configparser.ConfigParser(os.environ)
logger.info(f"Parsing config file {config_file}")

file_exists = False
if os.path.isfile(config_file):
with open(config_file) as f:
parser.read_string(f.read())
else:
try:
with open(config_file, 'r') as f:
parser.read_string(f.read())
file_exists = True
except Exception:
pass

if not file_exists:
logger.warning(
f"Unable to find config file at {config_file}, "
f"Unable to open config file {config_file}, "
"using default settings."
)

Expand Down
Empty file added tests/__init__.py
Empty file.
Empty file added tests/integration/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion tests/integration/test_auth.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import base64
import integ_test_base
from . import integ_test_base


class TestAuth(integ_test_base.IntegTestBase):
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_custom_evaluate_timeout.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import integ_test_base
from . import integ_test_base


class TestCustomEvaluateTimeout(integ_test_base.IntegTestBase):
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_deploy_and_evaluate_model.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import integ_test_base
from . import integ_test_base


class TestDeployAndEvaluateModel(integ_test_base.IntegTestBase):
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_deploy_and_evaluate_model_ssl.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import integ_test_base
from . import integ_test_base
import requests


Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_deploy_model_ssl_off_auth_off.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import integ_test_base
from . import integ_test_base


class TestDeployModelSSLOffAuthOff(integ_test_base.IntegTestBase):
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_deploy_model_ssl_off_auth_on.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import integ_test_base
from . import integ_test_base
import base64


Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_deploy_model_ssl_on_auth_off.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import integ_test_base
from . import integ_test_base
import requests


Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_deploy_model_ssl_on_auth_on.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import integ_test_base
from . import integ_test_base
import base64
import requests

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Script evaluation tests.
"""

import integ_test_base
from . import integ_test_base
import json


Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
All other misc. URL-related integration tests.
"""

import integ_test_base
from . import integ_test_base


class TestURL(integ_test_base.IntegTestBase):
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_url_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
when SSL is turned on for TabPy.
"""

import integ_test_base
from . import integ_test_base
import requests


Expand Down
Empty file added tests/unit/__init__.py
Empty file.
Empty file.

0 comments on commit d966774

Please sign in to comment.