-
Notifications
You must be signed in to change notification settings - Fork 946
/
test_command_export.py
66 lines (53 loc) · 2.53 KB
/
test_command_export.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# coding=utf-8
import itertools
import textwrap
import unittest
import pytest
from parameterized import parameterized
from conans.test.utils.scm import create_local_git_repo
from conans.test.utils.tools import TestClient
@pytest.mark.tool_svn
class ExportErrorCommandTestCase(unittest.TestCase):
conanfile = textwrap.dedent("""\
from conans import ConanFile
class Lib(ConanFile):
scm = {{"type": "{repo_type}",
"url": "{url_value}",
"revision": "{rev_value}"}}
""")
@parameterized.expand(itertools.product(["SVN", "git"], [(True, False), (False, True)]))
def test_no_repo(self, repo_type, autos):
auto_url, auto_rev = autos
url_value = "auto" if auto_url else "http://this.url"
rev_value = "auto" if auto_rev else "123"
self.client = TestClient()
self.client.save({"conanfile.py": self.conanfile.format(repo_type=repo_type.lower(),
url_value=url_value,
rev_value=rev_value)
})
self.client.run("export . lib/version@user/channel", assert_error=True)
self.assertIn("ERROR: '{}' is not a valid '{}' repository".format(
self.client.current_folder, repo_type.lower()), self.client.out)
@pytest.mark.tool_git
class ExportCommandTestCase(unittest.TestCase):
conanfile = textwrap.dedent("""\
from conans import ConanFile
class Lib(ConanFile):
scm = {{"type": "{repo_type}",
"url": "{url_value}",
"revision": "{rev_value}"}}
""")
@parameterized.expand([(True, False), (False, True)])
def test_non_existing_remote(self, auto_url, auto_rev):
url_value = "auto" if auto_url else "http://this.url"
rev_value = "auto" if auto_rev else "123"
self.path, _ = create_local_git_repo({"conanfile.py":
self.conanfile.format(repo_type="git",
url_value=url_value,
rev_value=rev_value)})
self.client = TestClient()
self.client.current_folder = self.path
self.client.run("export . lib/version@user/channel")
if auto_url:
self.assertIn("WARN: Repo origin cannot be deduced, 'auto' fields won't be replaced.",
self.client.out)