<commit_before>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 InstallMissingDependencie(unittest.TestCase):

    def setUp(self):
        test_server = TestServer()
        self.servers = {"myremote": test_server}
        self.client = TestClient(servers=self.servers, users={"myremote": [("lasote", "mypass")]})

        # Create deps packages
        dep1_conanfile = """from conans import ConanFile
class Dep1Pkg(ConanFile):
    name = "dep1"
    version = "{version}"
        """

        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.format(version="1.0")}, clean_first=True)
        self.client.run("create . lasote/testing")

        self.client.save({"conanfile.py": dep1_conanfile.format(version="2.0")}, clean_first=True)
        self.client.run("create . lasote/testing")

        self.client.save({"conanfile.py": dep2_conanfile}, clean_first=True)
        self.client.run("create . lasote/testing")

    def missing_dep_test(self):
        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"
        """
        self.client.save({"conanfile.py": foo_conanfile.format(dep1_version="1.0")},
                         clean_first=True)
        error = self.client.run("create . lasote/testing")
        self.assertFalse(error)

        self.client.save({"conanfile.py": foo_conanfile.format(dep1_version="2.0")},
                         clean_first=True)
        self.client.run("create . lasote/testing", ignore_error=True)
        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)
<commit_msg>fixes according to @memsharded review: code simplification<commit_after>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}
        self.client = TestClient(servers=self.servers, users={"myremote": [("lasote", "mypass")]})

        # Create deps packages
        dep1_conanfile = """from conans import ConanFile
class Dep1Pkg(ConanFile):
    name = "dep1"
        """

        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"
        """
        self.client.save({"conanfile.py": foo_conanfile.format(dep1_version="1.0")},
                         clean_first=True)
        error = self.client.run("create . lasote/testing")
        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)

{'fraction_non_alphanumeric': 0.13031674208144797, 'fraction_numerical': 0.016968325791855202, 'mean_word_length': 3.2880698351115423, 'pattern_counts': {'":': 13, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5155535', 'n_tokens_mistral': 1463, 'n_tokens_neox': 1442, 'n_words': 257}