Add files in tests

This commit is contained in:
Unknown 2020-06-23 10:58:35 -04:00
parent fee0a62ada
commit fb25b75deb
8 changed files with 30 additions and 30 deletions

View File

@ -5,7 +5,7 @@ import sys
import pytest import pytest
import translater as tr import translator as tr
# Parametrization of the fixture scratch_then_cache. The following array # Parametrization of the fixture scratch_then_cache. The following array

View File

@ -4,13 +4,13 @@ import pytest
from click.testing import CliRunner from click.testing import CliRunner
from path import Path from path import Path
from translater import settings, copy_file, log, load_idf from translator import settings, copy_file, log, load_idf
from translater.cli import cli from translator.cli import cli
from tests.test_trnsys import get_platform from tests.test_trnsys import get_platform
class TestCli: class TestCli:
"""Defines tests for usage of the translater Command Line Interface""" """Defines tests for usage of the translator Command Line Interface"""
@pytest.fixture( @pytest.fixture(
params=[ params=[
@ -73,7 +73,7 @@ class TestCli:
"--ep_version", "--ep_version",
"9-2-0", "9-2-0",
"--window_lib", "--window_lib",
"translater/ressources/W74-lib.dat", "translator/ressources/W74-lib.dat",
"tests/input_data/trnsys/simple_2_zone.idf", "tests/input_data/trnsys/simple_2_zone.idf",
"tests/input_data/CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw", "tests/input_data/CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw",
"--trnsidf_exe", "--trnsidf_exe",
@ -95,7 +95,7 @@ class TestCli:
"--ep_version", "--ep_version",
"9-2-0", "9-2-0",
"--template", "--template",
"translater/ressources/NewFileTemplate.d18", "translator/ressources/NewFileTemplate.d18",
"tests/input_data/trnsys/simple_2_zone.idf", "tests/input_data/trnsys/simple_2_zone.idf",
"tests/input_data/CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw", "tests/input_data/CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw",
"--trnsidf_exe", "--trnsidf_exe",

View File

@ -1,12 +1,12 @@
import os import os
import translater as tr import translator as tr
import pandas as pd import pandas as pd
import pytest import pytest
from path import Path from path import Path
from translater import EnergySeries, get_eplus_dirs, settings from translator import EnergySeries, get_eplus_dirs, settings
import numpy as np import numpy as np
@ -22,7 +22,7 @@ import numpy as np
], ],
) )
def energy_series(config, request): def energy_series(config, request):
from translater import ReportData from translator import ReportData
outputs = { outputs = {
"ep_object": "Output:Variable".upper(), "ep_object": "Output:Variable".upper(),
@ -62,7 +62,7 @@ def energy_series(config, request):
params=(["Water Heater Tank Temperature", "WaterSystems:EnergyTransfer"]) params=(["Water Heater Tank Temperature", "WaterSystems:EnergyTransfer"])
) )
def rd(request): def rd(request):
from translater import ReportData from translator import ReportData
file = Path("tests/input_data/trnsys/HeatPumpWaterHeater.sqlite") file = Path("tests/input_data/trnsys/HeatPumpWaterHeater.sqlite")
@ -73,7 +73,7 @@ def rd(request):
def test_EnergySeries(rd): def test_EnergySeries(rd):
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
from translater import EnergySeries from translator import EnergySeries
es = EnergySeries.from_sqlite(rd) es = EnergySeries.from_sqlite(rd)
es.plot() es.plot()

View File

@ -2,15 +2,15 @@ import os
import random import random
import subprocess import subprocess
import translater as tr import translator as tr
import matplotlib as mpl import matplotlib as mpl
# use agg backend so you don't need a display on travis-ci # use agg backend so you don't need a display on travis-ci
import pytest import pytest
from path import Path from path import Path
import translater.settings import translator.settings
from translater import EnergyPlusProcessError, get_eplus_dirs, settings, \ from translator import EnergyPlusProcessError, get_eplus_dirs, settings, \
parallel_process parallel_process
mpl.use("Agg") mpl.use("Agg")
@ -85,7 +85,7 @@ def test_load_old(config):
@pytest.mark.parametrize( @pytest.mark.parametrize(
"ep_version", "ep_version",
[translater.settings.ep_version, None], [translator.settings.ep_version, None],
ids=["specific-ep-version", "no-specific-ep-version"], ids=["specific-ep-version", "no-specific-ep-version"],
) )
def test_run_olderv(clean_config, ep_version): def test_run_olderv(clean_config, ep_version):
@ -175,7 +175,7 @@ def test_area(archetype, area):
"""Test the conditioned_area property against published values """Test the conditioned_area property against published values
desired values taken from https://github.com/canmet-energy/btap""" desired values taken from https://github.com/canmet-energy/btap"""
import numpy as np import numpy as np
from translater import load_idf from translator import load_idf
idf_file = Path("tests/input_data/necb/").glob("*{}*.idf".format(archetype)) idf_file = Path("tests/input_data/necb/").glob("*{}*.idf".format(archetype))
idf = load_idf(next(iter(idf_file))) idf = load_idf(next(iter(idf_file)))
@ -183,7 +183,7 @@ def test_area(archetype, area):
def test_wwr(): def test_wwr():
from translater import load_idf from translator import load_idf
idf_file = Path("tests/input_data/necb/").glob( idf_file = Path("tests/input_data/necb/").glob(
"*{}*.idf".format("FullServiceRestaurant") "*{}*.idf".format("FullServiceRestaurant")
@ -194,7 +194,7 @@ def test_wwr():
def test_partition_ratio(): def test_partition_ratio():
from translater import load_idf from translator import load_idf
idf_file = Path("tests/input_data/necb/").glob("*LargeOffice*.idf") idf_file = Path("tests/input_data/necb/").glob("*LargeOffice*.idf")
idf = load_idf(next(iter(idf_file))) idf = load_idf(next(iter(idf_file)))
@ -202,7 +202,7 @@ def test_partition_ratio():
def test_space_cooling_profile(config): def test_space_cooling_profile(config):
from translater import load_idf from translator import load_idf
file = ( file = (
get_eplus_dirs(settings.ep_version) get_eplus_dirs(settings.ep_version)
@ -218,7 +218,7 @@ def test_space_cooling_profile(config):
def test_space_heating_profile(config): def test_space_heating_profile(config):
from translater import load_idf from translator import load_idf
file = "tests/input_data/necb/NECB 2011-Warehouse-NECB HDD Method-CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw.idf" file = "tests/input_data/necb/NECB 2011-Warehouse-NECB HDD Method-CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw.idf"
wf = "tests/input_data/CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw" wf = "tests/input_data/CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw"
@ -229,7 +229,7 @@ def test_space_heating_profile(config):
def test_dhw_profile(config): def test_dhw_profile(config):
from translater import load_idf from translator import load_idf
file = "tests/input_data/necb/NECB 2011-Warehouse-NECB HDD Method-CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw.idf" file = "tests/input_data/necb/NECB 2011-Warehouse-NECB HDD Method-CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw.idf"
wf = "tests/input_data/CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw" wf = "tests/input_data/CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw"
@ -243,7 +243,7 @@ def test_dhw_profile(config):
def test_old_than_change_args(clean_config): def test_old_than_change_args(clean_config):
"""Should upgrade file only once even if run_eplus args are changed afterwards""" """Should upgrade file only once even if run_eplus args are changed afterwards"""
from translater import run_eplus from translator import run_eplus
file = ( file = (
get_eplus_dirs(settings.ep_version) get_eplus_dirs(settings.ep_version)

View File

@ -2,7 +2,7 @@ import os
import pytest import pytest
from translater import ( from translator import (
Schedule, Schedule,
load_idf, load_idf,
copy_file, copy_file,

View File

@ -5,7 +5,7 @@ import shutil
import pytest import pytest
import translater as tr import translator as tr
import pandas as pd import pandas as pd
@ -13,7 +13,7 @@ from path import Path
from copy import deepcopy from copy import deepcopy
from translater import ( from translator import (
convert_idf_to_trnbuild, convert_idf_to_trnbuild,
parallel_process, parallel_process,
trnbuild_idf, trnbuild_idf,
@ -27,7 +27,7 @@ from translater import (
) )
# Function round to hundreds # Function round to hundreds
from translater.trnsys import ( from translator.trnsys import (
_assert_files, _assert_files,
load_idf_file_and_clean_names, load_idf_file_and_clean_names,
clear_name_idf_objects, clear_name_idf_objects,
@ -72,7 +72,7 @@ from tests.conftest import get_platform
def converttesteasy(request): def converttesteasy(request):
file = request.param file = request.param
window_file = "W74-lib.dat" window_file = "W74-lib.dat"
template_dir = os.path.join("translater", "ressources") template_dir = os.path.join("translator", "ressources")
window_filepath = os.path.join(template_dir, window_file) window_filepath = os.path.join(template_dir, window_file)
template_d18 = "tests/input_data/trnsys/NewFileTemplate.d18" template_d18 = "tests/input_data/trnsys/NewFileTemplate.d18"
trnsidf_exe = "docker/trnsidf/trnsidf.exe" # 'docker/trnsidf/trnsidf.exe' trnsidf_exe = "docker/trnsidf/trnsidf.exe" # 'docker/trnsidf/trnsidf.exe'
@ -770,7 +770,7 @@ def converttest(request):
file = get_eplus_dirs(settings.ep_version) / "ExampleFiles" / request.param file = get_eplus_dirs(settings.ep_version) / "ExampleFiles" / request.param
# file = request.param # file = request.param
window_file = "W74-lib.dat" window_file = "W74-lib.dat"
template_dir = os.path.join("translater", "ressources") template_dir = os.path.join("translator", "ressources")
window_filepath = os.path.join(template_dir, window_file) window_filepath = os.path.join(template_dir, window_file)
template_d18 = "tests/input_data/trnsys/NewFileTemplate.d18" template_d18 = "tests/input_data/trnsys/NewFileTemplate.d18"
trnsidf_exe = "docker/trnsidf/trnsidf.exe" # 'docker/trnsidf/trnsidf.exe' trnsidf_exe = "docker/trnsidf/trnsidf.exe" # 'docker/trnsidf/trnsidf.exe'
@ -1162,7 +1162,7 @@ class TestTrnBuild:
def test_trnbuild_from_idf(self, config, trnbuild_file): def test_trnbuild_from_idf(self, config, trnbuild_file):
# Gets file paths/names # Gets file paths/names
window_file = "W74-lib.dat" window_file = "W74-lib.dat"
template_dir = os.path.join("translater", "ressources") template_dir = os.path.join("translator", "ressources")
window_filepath = os.path.join(template_dir, window_file) window_filepath = os.path.join(template_dir, window_file)
weather_file = os.path.join( weather_file = os.path.join(
"tests", "input_data", "CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw" "tests", "input_data", "CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw"
@ -1305,7 +1305,7 @@ class TestTrnBuild:
def test_trnbuild_from_simple_idf(config): def test_trnbuild_from_simple_idf(config):
# Path to weather file, window library and T3D template # Path to weather file, window library and T3D template
window_file = "W74-lib.dat" window_file = "W74-lib.dat"
template_dir = os.path.join("translater", "ressources") template_dir = os.path.join("translator", "ressources")
window_filepath = os.path.join(template_dir, window_file) window_filepath = os.path.join(template_dir, window_file)
weather_file = os.path.join( weather_file = os.path.join(
"tests", "input_data", "CAN_QC_Montreal-McTavish.716120_CWEC2016.epw" "tests", "input_data", "CAN_QC_Montreal-McTavish.716120_CWEC2016.epw"