8000 convert test dirs to packages (#1204) · jgugaliya/pvlib-python@709daa6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 709daa6

Browse files
authored
convert test dirs to packages (pvlib#1204)
* convert test dirs to packages * fix cross module import of fixture in test_location * add whats new
1 parent 1ebe7b0 commit 709daa6

36 files changed

+75
-74
lines changed

docs/sphinx/source/whatsnew/v0.9.0.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ Bug fixes
120120

121121
Testing
122122
~~~~~~~
123+
* Added ``__init__.py`` to ``pvlib/tests`` and subdirectories. This follows
124+
pytest recommendations for package layout and imports from ``conftest.py``.
125+
Solves issue with test discovery in vscode. (:pull:`1204`)
123126

124127
Documentation
125128
~~~~~~~~~~~~~

pvlib/tests/__init__.py

Whitespace-only changes.

pvlib/tests/conftest.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from functools import wraps
99

1010
import pvlib
11+
from pvlib.location import Location
1112

1213
pvlib_base_version = \
1314
parse_version(parse_version(pvlib.__version__).base_version)
@@ -187,6 +188,25 @@ def has_numba():
187188
)
188189

189190

191+
@pytest.fixture()
192+
def golden():
193+
return Location(39.742476, -105.1786, 'America/Denver', 1830.14)
194+
195+
196+
@pytest.fixture()
197+
def golden_mst():
198+
return Location(39.742476, -105.1786, 'MST', 1830.14)
199+
200+
201+
@pytest.fixture()
202+
def expected_solpos():
203+
return pd.DataFrame({'elevation': 39.872046,
204+
'apparent_zenith': 50.111622,
205+
'azimuth': 194.340241,
206+
'apparent_elevation': 39.888378},
207+
index=['2003-10-17T12:30:30Z'])
208+
209+
190210
@pytest.fixture(scope="session")
191211
def sam_data():
192212
data = {}

pvlib/tests/iotools/__init__.py

Whitespace-only changes.

pvlib/tests/iotools/test_bsrn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import pytest
88

99
from pvlib.iotools import bsrn
10-
from conftest import DATA_DIR, assert_index_equal
10+
from ..conftest import DATA_DIR, assert_index_equal
1111

1212

1313
@pytest.mark.parametrize('testfile,expected_index', [

pvlib/tests/iotools/test_crn.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import pandas as pd
2-
from conftest import assert_frame_equal
32
import numpy as np
43
from numpy import dtype, nan
54
import pytest
65
from pvlib.iotools import crn
7-
from conftest import DATA_DIR
6+
from ..conftest import DATA_DIR, assert_frame_equal
87

98

109
@pytest.fixture

pvlib/tests/iotools/test_ecmwf_macc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import datetime
77
import numpy as np
88
import pytest
9-
from conftest import requires_netCDF4, DATA_DIR
9+
from ..conftest import requires_netCDF4, DATA_DIR
1010
from pvlib.iotools import ecmwf_macc
1111

1212
TESTDATA = 'aod550_tcwv_20121101_test.nc'

pvlib/tests/iotools/test_epw.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import pytest
22

33
from pvlib.iotools import epw
4-
from conftest import DATA_DIR, RERUNS, RERUNS_DELAY
4+
from ..conftest import DATA_DIR, RERUNS, RERUNS_DELAY
55

66
epw_testfile = DATA_DIR / 'NLD_Amsterdam062400_IWEC.epw'
77

pvlib/tests/iotools/test_midc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import pytz
44

55
from pvlib.iotools import midc
6-
from conftest import DATA_DIR, RERUNS, RERUNS_DELAY
6+
from ..conftest import DATA_DIR, RERUNS, RERUNS_DELAY
77

88

99
@pytest.fixture

pvlib/tests/iotools/test_psm3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import os
66
from pvlib.iotools import psm3
7-
from conftest import DATA_DIR, RERUNS, RERUNS_DELAY
7+
from ..conftest import DATA_DIR, RERUNS, RERUNS_DELAY
88
import numpy as np
99
import pandas as pd
1010
import pytest

0 commit comments

Comments
 (0)
0