Commit c16689ab authored by Jennifer Rinker's avatar Jennifer Rinker
Browse files

fixing more paths

parent 9c8908d9
from py_wake.examples.data.iea37.iea37_reader import read_iea37_windturbine
from py_wake.data.iea37.iea37_reader import read_iea37_windturbine
from py_wake.wind_turbines import OneTypeWindTurbines
from py_wake.examples.data.iea37 import iea37_path
from py_wake.data.iea37 import iea37_path
from py_wake.site._site import UniformSite
import numpy as np
......@@ -15,7 +15,7 @@ class IEA37_Site(UniformSite):
def __init__(self, n_wt, ti=.75):
assert n_wt in [16, 36, 64]
from py_wake.examples.data.iea37.iea37_reader import read_iea37_windfarm,\
from py_wake.data.iea37.iea37_reader import read_iea37_windfarm,\
read_iea37_windrose
_, _, freq = read_iea37_windrose(iea37_path + "iea37-windrose.yaml")
......
import numpy as np
from py_wake.examples.data.iea37 import iea37_path
from py_wake.examples.data.iea37.iea37_reader import read_iea37_windrose,\
from py_wake.data.iea37 import iea37_path
from py_wake.data.iea37.iea37_reader import read_iea37_windrose,\
read_iea37_windturbine, read_iea37_windfarm
......
import importlib
import os
import pkgutil
import warnings
import pytest
import sys
from unittest import mock
from py_wake import examples
def get_main_modules():
package = examples
modules = []
for _, modname, _ in pkgutil.walk_packages(package.__path__, package.__name__ + '.'):
with warnings.catch_warnings():
warnings.simplefilter("ignore")
m = importlib.import_module(modname)
if 'main' in dir(m):
modules.append(m)
return modules
def print_main_modules():
print("\n".join([m.__name__ for m in get_main_modules()]))
@pytest.mark.parametrize("module", get_main_modules())
def test_main(module):
# check that all main module examples run without errors
if os.name == 'posix' and "DISPLAY" not in os.environ:
pytest.xfail("No display")
import matplotlib.pyplot as plt
def no_show(*args, **kwargs):
pass
plt.show = no_show # disable plt show that requires the user to close the plot
def no_print(*_):
pass
try:
with mock.patch.object(module, "__name__", "__main__"):
with mock.patch.object(module, "print", no_print):
getattr(module, 'main')()
except Exception as e:
raise type(e)(str(e) +
' in %s.main' % module.__name__).with_traceback(sys.exc_info()[2])
if __name__ == '__main__':
print_main_modules()
import numpy as np
from py_wake.examples.data.iea37.iea37_reader import read_iea37_windturbine
from py_wake.data.iea37.iea37_reader import read_iea37_windturbine
class WindTurbines():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment