-
Notifications
You must be signed in to change notification settings - Fork 56
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
3 changed files
with
42 additions
and
11 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
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,27 @@ | ||
import os | ||
|
||
from click.testing import CliRunner | ||
|
||
from ..nyaml2nxdl import nyaml2nxdl as conv | ||
from ..utils.nexus import find_definition_file | ||
|
||
# import subprocess | ||
|
||
|
||
def test_conversion(): | ||
root = find_definition_file("NXentry") | ||
# subprocess.run(["python3","-m","dev_tools.nyaml2nxdl.nyaml2nxdl","--input-file",root]) | ||
result = CliRunner().invoke(conv.launch_tool, ["--input-file", root]) | ||
assert result.exit_code == 0 | ||
yaml = root[:-9] + "_parsed.yaml" | ||
# subprocess.run(["python3","-m","dev_tools.nyaml2nxdl.nyaml2nxdl","--input-file",yaml]) | ||
result = CliRunner().invoke(conv.launch_tool, ["--input-file", yaml]) | ||
assert result.exit_code == 0 | ||
new_root = yaml[:-4] + "nxdl.xml" | ||
with open(root, encoding="utf-8", mode="r") as tmp_f: | ||
root_content = tmp_f.readlines() | ||
with open(new_root, encoding="utf-8", mode="r") as tmp_f: | ||
new_root_content = tmp_f.readlines() | ||
assert root_content == new_root_content | ||
os.remove(yaml) | ||
os.remove(new_root) |