Skip to content

Commit

Permalink
debug make-app tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Deys Timofey committed Sep 28, 2023
1 parent bf7d541 commit 6317fbb
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 11 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
# - mypy .
tests:
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
Expand All @@ -48,6 +49,14 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install .[tests]
# - name: Unit tests
# run: |
# pytest tests/unit_tests
- name: Integration tests
run: |
pytest tests/integration_tests
pytest tests/integration_tests > /tmp/integration_tests${{ matrix.python-version }}.log
- name: Read integration tests logs
if: always()
run: |
ls -la /tmp/
cat /tmp/integration_tests${{ matrix.python-version }}.log
31 changes: 22 additions & 9 deletions tests/integration_tests/console_commands/test_make_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import pickle
import signal
import subprocess
import sys
import time

import pytest
Expand All @@ -21,7 +22,6 @@
[{}, {'port': 8010}],
ids=['without_custom_params', 'with_custom_params']
)
@pytest.mark.skip
def test_run_maked_app_from_conf(
tmp_path_factory,
pickle_scikit_learn_model_config_yaml,
Expand All @@ -39,7 +39,7 @@ def test_run_maked_app_from_conf(
force=True,
)
proc = subprocess.Popen(
'python ' + path_to_app,
sys.executable + ' ' + path_to_app,
shell=True,
stderr=subprocess.PIPE,
universal_newlines=True,
Expand All @@ -57,10 +57,15 @@ def test_run_maked_app_from_conf(
time.sleep(i)
except Exception as e:
error = e
else:
if response.status_code != 200:
logger.error(response.status_code)
logger.error(response.text)
response = None
i += 1

# SIGTERM
os.kill(proc.pid, signal.SIGINT)
os.kill(proc.pid, signal.SIGKILL)
if error:
raise error

Expand All @@ -75,7 +80,6 @@ def test_run_maked_app_from_conf(
[{}, {'port': 8011}],
ids=['without_custom_params', 'with_custom_params']
)
@pytest.mark.skip
def test_run_maked_app_from_up_bin(tmp_path_factory, scikit_learn_binary_cls_model, custom_params):
path_to_app = str(tmp_path_factory.getbasetemp() / 'test_run_maked_app_from_up_bin' /
'test_run_maked_app_from_up_bin.py')
Expand All @@ -98,7 +102,7 @@ def test_run_maked_app_from_up_bin(tmp_path_factory, scikit_learn_binary_cls_mod
force=True,
)
proc = subprocess.Popen(
'python ' + path_to_app,
sys.executable + ' ' + path_to_app,
shell=True,
stderr=subprocess.PIPE,
universal_newlines=True,
Expand All @@ -116,10 +120,15 @@ def test_run_maked_app_from_up_bin(tmp_path_factory, scikit_learn_binary_cls_mod
time.sleep(i)
except Exception as e:
error = e
else:
if response.status_code != 200:
logger.error(response.status_code)
logger.error(response.text)
response = None
i += 1

# SIGTERM
os.kill(proc.pid, signal.SIGINT)
os.kill(proc.pid, signal.SIGKILL)
if error:
raise error

Expand All @@ -143,7 +152,6 @@ def test_run_maked_app_from_up_bin(tmp_path_factory, scikit_learn_binary_cls_mod
'with_custom_params'
]
)
@pytest.mark.skip
def test_run_maked_app_from_model_bin(tmp_path_factory, scikit_learn_binary_cls_model, custom_params):
path_to_app = str(tmp_path_factory.getbasetemp() / 'test_run_maked_app_from_model_bin' /
'test_run_maked_app_from_model_bin.py')
Expand All @@ -157,7 +165,7 @@ def test_run_maked_app_from_model_bin(tmp_path_factory, scikit_learn_binary_cls_
force=True,
)
proc = subprocess.Popen(
'python ' + path_to_app,
sys.executable + ' ' + path_to_app,
shell=True,
stderr=subprocess.PIPE,
universal_newlines=True,
Expand All @@ -179,10 +187,15 @@ def test_run_maked_app_from_model_bin(tmp_path_factory, scikit_learn_binary_cls_
time.sleep(i)
except Exception as e:
error = e
else:
if response.status_code != 200:
logger.error(response.status_code)
logger.error(response.text)
response = None
i += 1

# SIGTERM
os.kill(proc.pid, signal.SIGINT)
os.kill(proc.pid, signal.SIGKILL)
if error:
raise error

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class TestTensorFlowModel:
@pytest.mark.asyncio
async def test_load_from_source(self, binarizer_type, model_fixture_name, request):
if sys.version_info.minor == 7 and model_fixture_name == 'tensorflow_binary_cls_model_zip':
pytest.skip(f'For Python3.7 keras have version less 2.13 and dont have this model format.')
pytest.skip('For Python3.7 keras have version less 2.13 and dont have this model format.')
model_and_path = request.getfixturevalue(model_fixture_name)
up = UP(
conf=Config(
Expand Down

0 comments on commit 6317fbb

Please sign in to comment.