Skip to content

Commit

Permalink
don't import agent into the global space for tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
craig8 committed Nov 9, 2023
1 parent b9e68f2 commit 6d96f92
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions volttrontesting/utils/build_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import gevent

from volttron.platform.keystore import KeyStore
from volttron.platform.vip.agent import Agent
from volttrontesting.utils.platformwrapper import PlatformWrapper


Expand All @@ -13,9 +12,11 @@ def build_agent(platform: PlatformWrapper, identity=None, agent_class=None):
The agent identity will be set. If the identity is set to None
then a random identity will be created.
"""
from volttron.platform.vip.agent import Agent

if agent_class is None:
agent_class = Agent

os.environ['VOLTTRON_HOME'] = platform.volttron_home
agent = platform.build_agent(identity, agent_class=agent_class)
gevent.sleep(0.1) # switch context for a bit
Expand Down

0 comments on commit 6d96f92

Please sign in to comment.