Skip to content

Commit

Permalink
#3671 Testing new attribute: tags
Browse files Browse the repository at this point in the history
- Validate both inspect and info commands using tags
  as attribute

Signed-off-by: Uilian Ries <uilianries@gmail.com>
  • Loading branch information
uilianries committed Oct 9, 2018
1 parent d143d6c commit 3f4d969
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 1 deletion.
52 changes: 52 additions & 0 deletions conans/test/command/info_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,3 +473,55 @@ def wrong_path_parameter_test(self):

self.client.run("info conanfile.txt", ignore_error=True)
self.assertIn("ERROR: Conanfile not found", self.client.out)

def test_common_attributes(self):
self.client = TestClient()

conanfile = """from conans import ConanFile
from conans.util.files import load, save
class MyTest(ConanFile):
name = "Pkg"
version = "0.1"
settings = "build_type"
"""

self.client.save({"subfolder/conanfile.py": conanfile})
self.client.run("export ./subfolder lasote/testing")

self.client.run("info ./subfolder")

self.assertIn("Pkg/0.1@PROJECT", self.client.user_io.out)
self.assertNotIn("License: MIT", self.client.user_io.out)
self.assertNotIn("Author: John Doe", self.client.user_io.out)
self.assertNotIn("Tags: foo, bar, qux", self.client.user_io.out)
self.assertNotIn("URL: https://foo.bar.baz", self.client.user_io.out)

def test_full_attributes(self):
self.client = TestClient()

conanfile = """from conans import ConanFile
from conans.util.files import load, save
class MyTest(ConanFile):
name = "Pkg"
version = "0.2"
settings = "build_type"
author = "John Doe"
license = "MIT"
url = "https://foo.bar.baz"
tags = ["foo", "bar", "qux"]
"""

self.client.save({"subfolder/conanfile.py": conanfile})
self.client.run("export ./subfolder lasote/testing")

self.client.run("info ./subfolder")

self.assertIn("Pkg/0.2@PROJECT", self.client.user_io.out)
self.assertIn("License: MIT", self.client.user_io.out)
self.assertIn("Author: John Doe", self.client.user_io.out)
self.assertIn("Tags: foo, bar, qux", self.client.user_io.out)
self.assertIn("URL: https://foo.bar.baz", self.client.user_io.out)
35 changes: 34 additions & 1 deletion conans/test/command/inspect_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,37 @@ def build(self):
exports_sources: None
short_paths: False
apply_env: True
build_policy: None""", client.out)
build_policy: None
tags: None""", client.out)

def test_inspect_filled_attributes(self):
client = TestClient()
conanfile = """from conans import ConanFile
class Pkg(ConanFile):
name = "MyPkg"
version = "1.2.3"
author = "John Doe"
url = "https://john.doe.com"
license = "MIT"
description = "Yet Another Test"
generators = "cmake"
tags = ["foo", "bar", "qux"]
_private = "Nothing"
def build(self):
pass
"""
client.save({"conanfile.py": conanfile})
client.run("inspect .")
self.assertIn("""name: MyPkg
version: 1.2.3
url: https://john.doe.com
license: MIT
author: John Doe
description: Yet Another Test
generators: cmake
exports: None
exports_sources: None
short_paths: False
apply_env: True
build_policy: None
tags: ['foo', 'bar', 'qux']""", client.out)

0 comments on commit 3f4d969

Please sign in to comment.