kevinschoon commented on code in PR #2035:
URL: https://github.com/apache/buildstream/pull/2035#discussion_r2194790868


##########
tests/frontend/inspect.py:
##########
@@ -0,0 +1,61 @@
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+
+# Pylint doesn't play well with fixtures and dependency injection from pytest
+# pylint: disable=redefined-outer-name
+
+import os
+import pytest
+import json
+
+from buildstream._testing import cli  # pylint: disable=unused-import
+
+
+DATA_DIR = os.path.join(
+    os.path.dirname(os.path.realpath(__file__)),
+)
+
+def _element_by_name(elements, name):
+    for element in elements:
+        if element["name"] == name:
+            return element
+
+
[email protected](os.path.join(DATA_DIR, "simple"))
+def test_inspect_basic(cli, datafiles):
+    project = str(datafiles)
+    result = cli.run(project=project, silent=True, args=["inspect"])
+    result.assert_success()
+    output = json.loads(result.output)
+    assert(output["project"]["name"] == "test")
+    element = _element_by_name(output["elements"], "import-bin.bst")
+    source = element["sources"][0]
+    assert(source["kind"] == "local")
+    assert(source["url"] == "files/bin-files")

Review Comment:
   Thanks, I have cleaned up and parameterized the tests a bit in my last 
commit.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to