Skip to content

Commit

Permalink
updated testing and testing session in README
Browse files Browse the repository at this point in the history
  • Loading branch information
kefeimo committed May 12, 2023
1 parent f9698a1 commit 2007e71
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 15 deletions.
29 changes: 29 additions & 0 deletions services/core/DNP3OutstationAgent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,3 +297,32 @@ shown in the "Master Operation MENU" and should be self-explanatory. Here we can
Note: [run_dnp3_outstation_agent_script.py](demo-scripts/run_dnp3_outstation_agent_script.py) script is a wrapper on
the dnp3demo outstation submodle. For details about the interactive dnp3 station operations, please refer
to [dnp3demo-Module.md](https://github.com/VOLTTRON/dnp3-python/blob/develop/docs/dnp3demo-Module.md)
# Run Tests
1. Install volttron testing dependencies
```shell
(volttron) $ python bootstrap.py --testing
UPDATE: ['testing']
Installing required packages
+ pip install --upgrade --no-deps wheel==0.30
Requirement already satisfied: wheel==0.30 in ./env/lib/python3.10/site-packages (0.30.0)
+ pip install --upgrade --install-option --zmq=bundled --no-deps pyzmq==22.2.1
WARNING: Disabling all use of wheels due to the use of --build-option / --global-option / --install-option.
...
```
1. Run pytest
```shell
(volttron) $ pytest services/core/DNP3OutstationAgent/tests/.
===================================================================================================== test session starts =====================================================================================================
platform linux -- Python 3.10.6, pytest-7.1.2, pluggy-1.0.0 -- /home/kefei/project/volttron/env/bin/python
cachedir: .pytest_cache
rootdir: /home/kefei/project/volttron, configfile: pytest.ini
plugins: rerunfailures-10.2, asyncio-0.19.0, timeout-2.1.0
asyncio: mode=auto
timeout: 300.0s
timeout method: signal
timeout func_only: False
collected 40 items
```
31 changes: 16 additions & 15 deletions services/core/DNP3OutstationAgent/tests/test_dnp3_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@
from volttron.platform.vip.agent.utils import build_agent
from time import sleep
import datetime
from dnp3_outstation.agent import Dnp3OutstationAgent
# from dnp3_outstation.agent import Dnp3OutstationAgent
from services.core.DNP3OutstationAgent.dnp3_outstation_agent.agent import Dnp3Agent as Dnp3OutstationAgent
from dnp3_python.dnp3station.outstation_new import MyOutStationNew
import random
import subprocess
from volttron.utils import is_volttron_running
# from volttron.utils import is_volttron_running
import json
# from utils.testing_utils import *
from volttrontesting.fixtures.volttron_platform_fixtures import volttron_instance
Expand All @@ -32,19 +33,19 @@
dnp3_vip_identity = "dnp3_outstation"


@pytest.fixture(scope="module")
def volttron_home():
"""
VOLTTRON_HOME environment variable suggested to setup at pytest.ini [env]
"""
volttron_home: str = os.getenv("VOLTTRON_HOME")
assert volttron_home
return volttron_home


def test_volttron_home_fixture(volttron_home):
assert volttron_home
print(volttron_home)
# @pytest.fixture(scope="module")
# def volttron_home():
# """
# VOLTTRON_HOME environment variable suggested to setup at pytest.ini [env]
# """
# volttron_home: str = os.getenv("VOLTTRON_HOME")
# assert volttron_home
# return volttron_home
#
#
# def test_volttron_home_fixture(volttron_home):
# assert volttron_home
# print(volttron_home)


def test_testing_file_path():
Expand Down

0 comments on commit 2007e71

Please sign in to comment.