-
Notifications
You must be signed in to change notification settings - Fork 993
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add dependencies to package output info when binary is not found (close #3316) #3438
Changes from 4 commits
7be60f2
13f5ee0
038fc76
5c091a9
3623f1a
2a3af44
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import unittest | ||
from conans.test.utils.tools import TestClient, TestServer | ||
from conans.model.ref import ConanFileReference, PackageReference | ||
import os | ||
from conans.test.utils.cpp_test_files import cpp_hello_conan_files | ||
from conans.util.files import load, save | ||
from time import sleep | ||
import time | ||
from conans.paths import CONAN_MANIFEST | ||
|
||
|
||
class InstallMissingDependency(unittest.TestCase): | ||
|
||
def missing_dep_test(self): | ||
test_server = TestServer() | ||
self.servers = {"myremote": test_server} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Finally, there is no upload, so you can remove the server. |
||
self.client = TestClient(servers=self.servers, users={"myremote": [("lasote", "mypass")]}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do not use |
||
|
||
# Create deps packages | ||
dep1_conanfile = """from conans import ConanFile | ||
class Dep1Pkg(ConanFile): | ||
name = "dep1" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Name also unnecessary. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know, but I prefer to keep the name in the recipe... at least to know but that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair enough, you can leave the name. |
||
""" | ||
|
||
dep2_conanfile = """from conans import ConanFile | ||
class Dep2Pkg(ConanFile): | ||
name = "dep2" | ||
version = "1.0" | ||
requires = "dep1/1.0@lasote/testing" | ||
""" | ||
|
||
self.client.save({"conanfile.py": dep1_conanfile}, clean_first=True) | ||
self.client.run("create . dep1/1.0@lasote/testing") | ||
self.client.run("create . dep1/2.0@lasote/testing") | ||
|
||
self.client.save({"conanfile.py": dep2_conanfile}, clean_first=True) | ||
self.client.run("create . lasote/testing") | ||
|
||
foo_conanfile = """from conans import ConanFile | ||
class FooPkg(ConanFile): | ||
name = "foo" | ||
version = "1.0" | ||
requires = "dep1/{dep1_version}@lasote/testing", "dep2/1.0@lasote/testing" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why 2 dependencies? The test can be perfectly done with 1. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The issue we are testing is that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It could be tested such output, even if the binary is missing for another reason, so not really necessary to have such complex dependency graph. But I agree, it is nicer to test the full case, just in case. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, you are right, we can remove I can leave here the minimum test and maybe create a new test module to store those tests that are 1-to-1 related to an specific issue. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need to do 2 tests, I think this one is ok here, just with some improvements. |
||
""" | ||
self.client.save({"conanfile.py": foo_conanfile.format(dep1_version="1.0")}, | ||
clean_first=True) | ||
error = self.client.run("create . lasote/testing") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove this error |
||
self.assertFalse(error) | ||
|
||
self.client.save({"conanfile.py": foo_conanfile.format(dep1_version="2.0")}, | ||
clean_first=True) | ||
error = self.client.run("create . lasote/testing", ignore_error=True) | ||
self.assertTrue(error) | ||
self.assertIn("Can't find a 'dep2/1.0@lasote/testing' package", self.client.user_io.out) | ||
self.assertIn("- Dependencies: dep1/2.0@lasote/testing", self.client.user_io.out) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused imports. Try to enable a linter (like pep8, pycodestyle) in your IDE, it typically warns about unused imports (and unused variables, etc).
Also, try to follow the import order: first python ones, then dependencies, then conan imports.