Skip to content

Commit

Permalink
fixing unittests errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Dozgulbas committed Jun 12, 2024
1 parent bfacd53 commit d8c2234
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 69 deletions.
30 changes: 8 additions & 22 deletions tests/test_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
from pathlib import Path

import requests

# from wei.core.data_classes import ModuleAbout, Workcell
from wei import ExperimentClient
from wei.types import Workcell


Expand All @@ -23,7 +22,12 @@ def __init__(self, *args, **kwargs):
self.url = f"http://{self.server_host}:{self.server_port}"
self.module_url = "http://ur_module:3011"
self.redis_host = self.workcell.config.redis_host

self.experiment = ExperimentClient(
server_host=self.server_host,
server_port=self.server_port,
experiment_name="Test_Experiment",
working_dir=Path(__file__).resolve().parent,
)
# Check to see that server is up
start_time = time.time()
while True:
Expand All @@ -35,26 +39,8 @@ def __init__(self, *args, **kwargs):
time.sleep(1)
if time.time() - start_time > 60:
raise TimeoutError("Server did not start in 60 seconds")
while True:
try:
if requests.get(self.module_url + "/state").status_code == 200:
break
except Exception:
pass
time.sleep(1)
if time.time() - start_time > 60:
raise TimeoutError("Module did not start in 60 seconds")


# class TestModuleInterfaces(TestWEI_Base):
# """Tests the basic functionality of the Module."""

# def test_module_about(self):
# """Tests that the module's /about endpoint works"""
# response = requests.get(self.module_url + "/about")
# assert response.status_code == 200
# ModuleAbout(**response.json())


if __name__ == "__main__":
t = TestWEI_Base()
unittest.main()
10 changes: 5 additions & 5 deletions wei.compose.yaml → tests/wei.compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ services:
environment:
- PYTHONUNBUFFERED=1 # Fix weird bug with empty logging
volumes:
- ${WORKCELLS_DIR}:/workcell_defs
- ${WORKCELLS_DIR}:/workcells
- ${WEI_DATA_DIR}:/home/app/.wei
- diaspora_config:/home/app/.diaspora
command: python3 -m wei.server --workcell /workcell_defs/${WORKCELL_FILENAME}
command: python3 -m wei.server --workcell /workcells/${WORKCELL_FILENAME}
depends_on:
- wei_redis
wei_engine:
image: ghcr.io/ad-sdl/wei
container_name: wei_engine
volumes:
- ${WORKCELLS_DIR}:/workcell_defs
- ${WORKCELLS_DIR}:/workcells
- ${WEI_DATA_DIR}:/home/app/.wei
env_file: .env
environment:
- PYTHONUNBUFFERED=1 # Fix weird bug with empty logging
command: python3 -m wei.engine --workcell /workcell_defs/${WORKCELL_FILENAME}
command: python3 -m wei.engine --workcell /workcells/${WORKCELL_FILENAME}
depends_on:
- wei_redis
- wei_server
Expand All @@ -40,7 +40,7 @@ services:
- ${REDIS_DIR}:/data
command: redis-server --save 60 1 --loglevel warning

################
################/Users/dozgulbas/workspace/ur_module/workcells/test_workcell.yaml
# Data Storage #
################
volumes:
Expand Down
19 changes: 0 additions & 19 deletions tests/workcell_defs/test_workcell.yaml

This file was deleted.

23 changes: 0 additions & 23 deletions tests/workflow_defs/test_workflow.yaml

This file was deleted.

0 comments on commit d8c2234

Please sign in to comment.