Skip to content

Commit

Permalink
Add pip warning to inverter_check.py
Browse files Browse the repository at this point in the history
  • Loading branch information
mletenay committed May 8, 2024
1 parent 702b53a commit 5ba0d18
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/inverter_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
import asyncio
import logging
import sys
from importlib.metadata import version

# Force the local files, not pip installed lib
sys.path.insert(0, '../goodwe')
sys.path.insert(0, '../../goodwe')

import goodwe

logging.basicConfig(
Expand All @@ -16,6 +19,19 @@
if sys.platform.startswith('win'):
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

module_ver = None
try:
module_ver = version('goodwe')
except ModuleNotFoundError:
pass

if module_ver:
print("WARNING !!!")
print("==============================")
print(f"You are executing code with installed pip version goodwe:{module_ver}")
print("You are not testing the local files, if that was what you meant !!!")
print("==============================")

# Set the appropriate IP address
IP_ADDRESS = "192.168.2.14"
PORT = 8899
Expand Down

0 comments on commit 5ba0d18

Please sign in to comment.