Skip to content

Commit 716b291

Browse files
Refactored config file and corresponding tests
1 parent fb3359a commit 716b291

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

astroquery/esa/xmm_newton/tests/setup_package.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
def get_package_data():
2020
paths = [os.path.join('data', '*.tar'),
2121
os.path.join('data', '*.xml'),
22-
os.path.join('my_config.ini')
22+
os.path.join('data', '*.ini')
2323
] # etc, add other extensions
2424
# you can also enlist files individually by names
2525
# finally construct and return a dict for the sub module

astroquery/esa/xmm_newton/tests/test_xmm_newton.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
from astroquery.exceptions import LoginError
2121

2222

23+
def data_path(filename):
24+
data_dir = os.path.join(os.path.dirname(__file__), 'data')
25+
return os.path.join(data_dir, filename)
26+
27+
2328
class mockResponse():
2429
headers = {'Date': 'Wed, 24 Nov 2021 13:43:50 GMT',
2530
'Server': 'Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.2k-fips',
@@ -548,7 +553,8 @@ def test_request_link_incorrect_credentials(self, mock_request):
548553

549554
def test_get_username_and_password(self):
550555
xsa = XMMNewtonClass(self.get_dummy_tap_handler())
551-
username, password = xsa._get_username_and_password("astroquery/esa/xmm_newton/tests/my_config.ini")
556+
file = data_path("my_config.ini")
557+
username, password = xsa._get_username_and_password(file)
552558
assert username == "test"
553559
assert password == "test"
554560

0 commit comments

Comments
 (0)