-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
52 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from pathlib import Path | ||
from tempfile import TemporaryDirectory | ||
|
||
import findlibs | ||
|
||
import pyfdb | ||
|
||
|
||
def test_lib_path(): | ||
# pyfdb uses findlibs internally to locate the library | ||
# So this looks a bit circular but it's just to check that we can pass a path explicitly | ||
# The `libpath` argument allows the user to hard code the path to the library. | ||
# This should not be necessary in normal usage but it's a useful backup. | ||
lib_path = findlibs.find("fdb5") | ||
|
||
with TemporaryDirectory() as tmp_root: | ||
tests_dir = Path(__file__).parent | ||
|
||
config = dict( | ||
type="local", | ||
engine="toc", | ||
schema=str(tests_dir / "default_fdb_schema"), | ||
spaces=[ | ||
dict( | ||
handler="Default", | ||
roots=[ | ||
{"path": tmp_root, "write": True}, | ||
], | ||
) | ||
], | ||
) | ||
|
||
fdb = pyfdb.FDB(config=config) | ||
data = open(tests_dir / "x138-300.grib", "rb").read() | ||
fdb.archive(data) | ||
fdb.flush() | ||
list_output = list(fdb.list(keys=True)) | ||
assert len(list_output) == 1 | ||
print("external lib", pyfdb.lib) | ||
assert pyfdb.lib.path == lib_path |