Skip to content
Snippets Groups Projects
Commit 1c86dc20 authored by Ladislav Lhotka's avatar Ladislav Lhotka
Browse files

Use data model fixture for tests.

parent 393c1a9d
Branches
Tags
No related merge requests found
Pipeline #129 skipped
PROJECT = yangson
.PHONY = tags deps install-deps test
tags:
find $(PROJECT) -name "*.py" | etags -
......@@ -8,3 +9,6 @@ deps:
install-deps:
pip install -r requirements.txt
test:
@py.test tests
import pytest
from yangson import DataModel
def test_turing():
@pytest.fixture
def data_model():
tdir = "examples/turing/"
with open(tdir + "yang-library.json", encoding="utf-8") as ylfile:
ylib = ylfile.read()
dm = DataModel.from_yang_library(ylib, tdir)
top = dm.get_data_node("/turing-machine:turing-machine")
assert top.name == "turing-machine"
assert top.ns == "turing-machine"
return DataModel.from_yang_library(ylib, tdir)
def test_top(data_model):
top = data_model.get_data_node("/turing-machine:turing-machine")
assert top.qname == "turing-machine:turing-machine"
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment