Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: version ranges without user/channel
- Loading branch information
Showing
2 changed files
with
43 additions
and
2 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
41 changes: 41 additions & 0 deletions
41
conans/test/functional/graph/version_range_no_userchannel_test.py
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,41 @@ | ||
# coding=utf-8 | ||
|
||
import unittest | ||
|
||
from conans.test.utils.tools import TestClient, GenConanfile | ||
|
||
|
||
class VersionRangeNoUserChannelTestCase(unittest.TestCase): | ||
|
||
def test_match(self): | ||
t = TestClient() | ||
t.save({"conanfile.py": GenConanfile(), }) | ||
t.run("export . libB/1.0@") | ||
|
||
# Use version ranges without user/channel | ||
t.save({"conanfile.py": GenConanfile().with_require_plain("libB/[~1.x]")}) | ||
t.run("info . --only requires") | ||
self.assertIn("Version range '~1.x' required by 'conanfile.py'" | ||
" resolved to 'libB/1.0' in local cache", t.out) | ||
|
||
def test_no_match(self): | ||
t = TestClient() | ||
t.save({"conanfile.py": GenConanfile(), }) | ||
t.run("export . libB/1.0@user/channel") | ||
|
||
# Use version ranges without user/channel | ||
t.save({"conanfile.py": GenConanfile().with_require_plain("libB/[~1.x]")}) | ||
t.run("info . --only requires", assert_error=True) | ||
self.assertIn("ERROR: Version range '~1.x' from requirement 'libB/[~1.x]' required" | ||
" by 'conanfile.py' could not be resolved in local cache", t.out) | ||
|
||
def test_no_match_with_userchannel(self): | ||
t = TestClient() | ||
t.save({"conanfile.py": GenConanfile(), }) | ||
t.run("export . libB/1.0@") | ||
|
||
# Use version ranges with user/channel | ||
t.save({"conanfile.py": GenConanfile().with_require_plain("libB/[~1.x]@user/channel")}) | ||
t.run("info . --only requires", assert_error=True) | ||
self.assertIn("ERROR: Version range '~1.x' from requirement 'libB/[~1.x]@user/channel'" | ||
" required by 'conanfile.py' could not be resolved in local cache", t.out) |