Skip to content

Commit 66fbad7

Browse files
committed
Remove Jupyter notebook test file and refactor backup-related tests in test_config.py.
1 parent ff95a0a commit 66fbad7

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ lintblack: ## check style with black
5454
black --check src/planetarypy tests
5555

5656
test: ## run tests quickly with the default Python
57-
jupyter nbconvert --to python tests/test_*.ipynb
5857
pytest --cov
5958

6059
test-all: ## run tests on every Python version with tox

src/planetarypy/config.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from pathlib import Path
1010
from typing import Union
1111

12-
import toml
12+
import tomlkit
1313

1414

1515
def reset_non_urls(
@@ -57,7 +57,7 @@ def _read_config(self):
5757
5858
`storage_root` will be stored as attribute.
5959
"""
60-
self.tomldoc = toml.loads(self.path.read_text())
60+
self.tomldoc = tomlkit.loads(self.path.read_text())
6161
if not self.tomldoc["storage_root"]:
6262
path = Path.home() / "planetarypy_data"
6363
path.mkdir(exist_ok=True)
@@ -78,7 +78,7 @@ def __getitem__(self, key: str):
7878
key = "missions." + key
7979
try:
8080
return reduce(lambda c, k: c[k], key.split("."), self.d)
81-
except toml.exceptions.NonExistentKey:
81+
except KeyError:
8282
return ""
8383

8484
def get_value(
@@ -90,7 +90,7 @@ def get_value(
9090
key = "missions." + key
9191
try:
9292
return reduce(lambda c, k: c[k], key.split("."), self.d)
93-
except toml.exceptions.NonExistentKey:
93+
except KeyError:
9494
return ""
9595

9696
def set_value(
@@ -119,7 +119,7 @@ def __setitem__(self, nested_key: str, value: Union[float, str]):
119119

120120
def save(self):
121121
"""Write the TOML doc to file."""
122-
self.path.write_text(toml.dumps(self.tomldoc))
122+
self.path.write_text(tomlkit.dumps(self.tomldoc))
123123

124124
@property
125125
def missions(self):

0 commit comments

Comments
 (0)