Fixed unique refs
import unittest
import sys
+import time
from conans.client.conan_api import ConanAPIV1
from conans.model.ref import ConanFileReference
@@ -17,7 +18,7 @@ class DockerTest(BaseTest):
@unittest.skipUnless(sys.platform.startswith("linux"), "Requires Linux")
def test_docker(self):
self.deploy_pip()
-
+ unique_ref = "zlib/%s" % str(time.time())
conanfile = """from conans import ConanFile
import os
@@ -39,20 +40,22 @@ class Pkg(ConanFile):
gcc_versions=["6"],
archs=["x86", "x86_64"],
build_types=["Release"],
- reference="zlib/1.2.2")
+ reference=unique_ref)
self.packager.add_common_builds()
self.packager.run()
+ search_pattern = "%s*" % unique_ref
+ ref = ConanFileReference.loads("%s@lasote/mychannel" % unique_ref)
+
# Remove from remote
- self.assertEquals(len(self.api.search_recipes("zlib*", remote="upload_repo")), 1)
- packages = self.api.search_packages(ConanFileReference.loads("zlib/1.2.2@lasote/mychannel"),
- remote="upload_repo")[0]
+ self.assertEquals(len(self.api.search_recipes(search_pattern, remote="upload_repo")), 1)
+ packages = self.api.search_packages(ref, remote="upload_repo")[0]
self.assertEquals(len(packages), 2)
self.api.authenticate(name=CONAN_LOGIN_UPLOAD, password=CONAN_UPLOAD_PASSWORD,
remote="upload_repo")
- self.api.remove("zlib*", remote="upload_repo", force=True)
- self.assertEquals(self.api.search_recipes("zlib*"), [])
+ self.api.remove(search_pattern, remote="upload_repo", force=True)
+ self.assertEquals(self.api.search_recipes(search_pattern), [])
# Try upload only when stable, shouldn't upload anything
with tools.environment_append({"CONAN_USE_DOCKER": "1",
@@ -67,8 +70,9 @@ class Pkg(ConanFile):
gcc_versions=["6"],
archs=["x86", "x86_64"],
build_types=["Release"],
- reference="zlib/1.2.2")
+ reference=unique_ref)
self.packager.add_common_builds()
self.packager.run()
- self.assertEquals(len(self.api.search_recipes("zlib*", remote="upload_repo")), 0)
+ self.assertEquals(len(self.api.search_recipes(search_pattern, remote="upload_repo")), 0)
+ self.api.remove(search_pattern, remote="upload_repo", force=True)
\ No newline at end of file
