Skip to content

Commit

Permalink
fixed imports of moved tests
Browse files Browse the repository at this point in the history
  • Loading branch information
memsharded committed May 21, 2024
1 parent c6748b1 commit 0597c50
Show file tree
Hide file tree
Showing 499 changed files with 1,692 additions and 943 deletions.
12 changes: 6 additions & 6 deletions .ci/jenkins/testsv2.jenkins
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ String getTempFolder(String nodeName) {
List<Map> getConfigurations(String moduleName, String branchName, String jobName) {
// TODO: handle revision cases
def configs = []
if (moduleName=="conans/test/unittests" || moduleName=="conans/test/integration") {
if (moduleName=="test/unittests" || moduleName=="test/integration") {
configs.add([node: "Linux", pyvers: ["PY312"]])
}
if (branchName =~ /(^PR-.*)/) {
Expand All @@ -39,18 +39,18 @@ List<Map> getConfigurations(String moduleName, String branchName, String jobName
}

String getDockerImage(String moduleName) {
if (moduleName=="conans/test/unittests" || moduleName=="conans/test/integration") {
if (moduleName=="test/unittests" || moduleName=="test/integration") {
return "conanio/ci-unittests"
}
else if (moduleName=="conans/test/functional"){
else if (moduleName=="test/functional"){
return "conanio/ci-functional"
}
return ""
}

boolean shouldTestServer(String moduleName) {
// run conan_server --help after running functional tests
if (moduleName=="conans/test/functional") {
if (moduleName=="test/functional") {
return true
}
return false
Expand Down Expand Up @@ -167,7 +167,7 @@ void runTestsModule(String moduleName, String branchName, String jobName) {
parallel(paralellRuns)
}

def testModules = ["conans/test/unittests", "conans/test/integration", "conans/test/functional"]
def testModules = ["test/unittests", "test/integration", "test/functional"]

void deployToPypiTest() {
node("Linux") {
Expand Down Expand Up @@ -198,7 +198,7 @@ void deployToPypiTest() {
try {
cancelPrevious()


testModules.each { moduleName ->
runTestsModule(moduleName, branchName, jobName)
}
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,5 @@ Session.vim
# add excluded
!conans/client/build
!conan/tools/build
!conans/test/unittests/client/build
!conans/test/unittests/tools/build
!test/unittests/client/build
!test/unittests/tools/build
4 changes: 2 additions & 2 deletions conan/test/assets/pkg_cmake.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import textwrap

from conans.model.recipe_ref import RecipeReference
from conans.test.assets.cmake import gen_cmakelists
from conans.test.assets.sources import gen_function_h, gen_function_cpp
from conan.test.assets.cmake import gen_cmakelists
from conan.test.assets.sources import gen_function_h, gen_function_cpp


def pkg_cmake(name, version, requires=None, exe=False):
Expand Down
2 changes: 1 addition & 1 deletion conan/test/utils/file_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import bottle
from webtest import TestApp

from conans.test.utils.test_files import temp_folder
from conan.test.utils.test_files import temp_folder
from conans.util.files import mkdir


Expand Down
2 changes: 1 addition & 1 deletion conan/test/utils/scm.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os

from conans.test.utils.test_files import temp_folder
from conan.test.utils.test_files import temp_folder
from conans.util.files import save_files, chdir
from conans.util.runners import check_output_runner

Expand Down
2 changes: 1 addition & 1 deletion conan/test/utils/server_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from conans.server.migrate import migrate_and_get_server_config
from conans.server.rest.server import ConanServer
from conans.server.service.authorize import BasicAuthenticator, BasicAuthorizer
from conans.test.utils.test_files import temp_folder
from conan.test.utils.test_files import temp_folder


TESTING_REMOTE_PRIVATE_USER = "private_user"
Expand Down
52 changes: 41 additions & 11 deletions conan/test/utils/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,50 @@
from conans.model.profile import Profile
from conans.model.recipe_ref import RecipeReference
from conans.model.settings import Settings
from conans.test.assets import copy_assets
from conans.test.assets.genconanfile import GenConanfile
from conans.test.conftest import default_profiles
from conans.test.utils.artifactory import ArtifactoryServer
from conans.test.utils.mocks import RedirectedInputStream
from conans.test.utils.mocks import RedirectedTestOutput
from conans.test.utils.scm import create_local_git_repo
from conans.test.utils.server_launcher import (TestServerLauncher)
from conans.test.utils.test_files import temp_folder
from conan.test.assets import copy_assets
from conan.test.assets.genconanfile import GenConanfile
from conan.test.utils.artifactory import ArtifactoryServer
from conan.test.utils.mocks import RedirectedInputStream
from conan.test.utils.mocks import RedirectedTestOutput
from conan.test.utils.scm import create_local_git_repo
from conan.test.utils.server_launcher import (TestServerLauncher)
from conan.test.utils.test_files import temp_folder
from conans.util.env import get_env
from conans.util.files import mkdir, save_files, save, load

NO_SETTINGS_PACKAGE_ID = "da39a3ee5e6b4b0d3255bfef95601890afd80709"

arch = platform.machine()
arch_setting = "armv8" if arch in ["arm64", "aarch64"] else arch
default_profiles = {
"Windows": textwrap.dedent("""\
[settings]
os=Windows
arch=x86_64
compiler=msvc
compiler.version=191
compiler.runtime=dynamic
build_type=Release
"""),
"Linux": textwrap.dedent(f"""\
[settings]
os=Linux
arch={arch_setting}
compiler=gcc
compiler.version=8
compiler.libcxx=libstdc++11
build_type=Release
"""),
"Darwin": textwrap.dedent(f"""\
[settings]
os=Macos
arch={arch_setting}
compiler=apple-clang
compiler.version=13
compiler.libcxx=libc++
build_type=Release
""")
}

def inc_recipe_manifest_timestamp(cache, reference, inc_time):
ref = RecipeReference.loads(reference)
Expand Down Expand Up @@ -548,7 +578,7 @@ def run(self, command_line, assert_error=False, redirect_stdout=None, redirect_s
If user or password is filled, user_io will be mocked to return this
tuple if required
"""
from conans.test.utils.mocks import RedirectedTestOutput
from conan.test.utils.mocks import RedirectedTestOutput
with environment_update({"NO_COLOR": "1"}): # Not initialize colorama in testing
self.user_inputs = RedirectedInputStream(inputs or self.inputs)
self.stdout = RedirectedTestOutput() # Initialize each command
Expand Down Expand Up @@ -579,7 +609,7 @@ def run(self, command_line, assert_error=False, redirect_stdout=None, redirect_s
save(os.path.join(self.current_folder, redirect_stderr), self.stderr)

def run_command(self, command, cwd=None, assert_error=False):
from conans.test.utils.mocks import RedirectedTestOutput
from conan.test.utils.mocks import RedirectedTestOutput
self.stdout = RedirectedTestOutput() # Initialize each command
self.stderr = RedirectedTestOutput()
try:
Expand Down
5 changes: 1 addition & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@

# The tests utils are used by conan-package-tools
here = path.abspath(path.dirname(__file__))
excluded_test_packages = ["conans.test.{}*".format(d)
for d in os.listdir(os.path.join(here, "conans/test"))
if os.path.isdir(os.path.join(here, "conans/test", d)) and
d not in ("utils", "assets")]
excluded_test_packages = ["test"]


def get_requires(filename):
Expand Down
5 changes: 1 addition & 4 deletions setup_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@

# The tests utils are used by conan-package-tools
here = path.abspath(path.dirname(__file__))
excluded_test_packages = ["conans.test.{}*".format(d)
for d in os.listdir(os.path.join(here, "conans/test"))
if os.path.isdir(os.path.join(here, "conans/test", d)) and
d not in ("utils", "assets")]
excluded_test_packages = ["test"]


def get_requires(filename):
Expand Down
42 changes: 2 additions & 40 deletions test/conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os
import pathlib
import platform
import textwrap
import uuid
from shutil import which

Expand Down Expand Up @@ -188,40 +187,10 @@


# TODO: Make this match the default tools (compilers) above automatically
arch = platform.machine()
arch_setting = "armv8" if arch in ["arm64", "aarch64"] else arch
default_profiles = {
"Windows": textwrap.dedent("""\
[settings]
os=Windows
arch=x86_64
compiler=msvc
compiler.version=191
compiler.runtime=dynamic
build_type=Release
"""),
"Linux": textwrap.dedent(f"""\
[settings]
os=Linux
arch={arch_setting}
compiler=gcc
compiler.version=8
compiler.libcxx=libstdc++11
build_type=Release
"""),
"Darwin": textwrap.dedent(f"""\
[settings]
os=Macos
arch={arch_setting}
compiler=apple-clang
compiler.version=13
compiler.libcxx=libc++
build_type=Release
""")
}


try:
from conans.test.conftest_user import tools_locations as user_tool_locations
from test.conftest_user import tools_locations as user_tool_locations

def update(d, u):
for k, v in u.items():
Expand All @@ -236,13 +205,6 @@ def update(d, u):
user_tool_locations = None


try:
from conans.test.conftest_user import default_profiles as user_default_profiles
default_profiles.update(user_default_profiles)
except ImportError as e:
user_default_profiles = None


tools_environments = {
'mingw32': {'Windows': {'MSYSTEM': 'MINGW32'}},
'mingw64': {'Windows': {'MSYSTEM': 'MINGW64'}},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import pytest

from conans.test.utils.tools import TestClient
from conan.test.utils.tools import TestClient


@pytest.mark.xfail(reason="This was using legacy cmake_find_package generator, need to be tested "
Expand Down
8 changes: 4 additions & 4 deletions test/functional/command/config_install_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
from conans.client.conf.config_installer import _hide_password
from conans.client.downloaders.file_downloader import FileDownloader
from conans.paths import DEFAULT_CONAN_HOME
from conans.test.assets.genconanfile import GenConanfile
from conans.test.utils.file_server import TestFileServer
from conans.test.utils.test_files import scan_folder, temp_folder, tgz_with_contents
from conans.test.utils.tools import TestClient, zipdir
from conan.test.assets.genconanfile import GenConanfile
from conan.test.utils.file_server import TestFileServer
from conan.test.utils.test_files import scan_folder, temp_folder, tgz_with_contents
from conan.test.utils.tools import TestClient, zipdir
from conans.util.files import load, mkdir, save, save_files


Expand Down
2 changes: 1 addition & 1 deletion test/functional/command/devflow_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import unittest

from conans.test.utils.tools import TestClient
from conan.test.utils.tools import TestClient
from conans.util.files import load, mkdir

conanfile = '''
Expand Down
6 changes: 3 additions & 3 deletions test/functional/command/export_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import pytest

from conans.test.assets.genconanfile import GenConanfile
from conans.test.utils.scm import git_add_changes_commit
from conans.test.utils.tools import TestClient
from conan.test.assets.genconanfile import GenConanfile
from conan.test.utils.scm import git_add_changes_commit
from conan.test.utils.tools import TestClient
from conans.util.files import save


Expand Down
2 changes: 1 addition & 1 deletion test/functional/command/new_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest as pytest

from conans.test.utils.tools import TestClient
from conan.test.utils.tools import TestClient


# TODO: Remove this test once this feature is used elsewhere to test other things
Expand Down
4 changes: 2 additions & 2 deletions test/functional/command/profile_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import pytest

from conans.client.conf.detect import detect_defaults_settings
from conans.test.utils.mocks import RedirectedTestOutput
from conans.test.utils.tools import TestClient, redirect_output
from conan.test.utils.mocks import RedirectedTestOutput
from conan.test.utils.tools import TestClient, redirect_output
from conans.util.env import environment_update
from conans.util.files import save
from conans.util.runners import check_output_runner
Expand Down
4 changes: 2 additions & 2 deletions test/functional/command/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import os
import textwrap

from conans.test.assets.genconanfile import GenConanfile
from conans.test.utils.tools import TestClient
from conan.test.assets.genconanfile import GenConanfile
from conan.test.utils.tools import TestClient


def test_build_different_folders():
Expand Down
6 changes: 3 additions & 3 deletions test/functional/command/test_custom_symlink_home.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

import pytest

from conans.test.utils.scm import create_local_git_repo
from conans.test.utils.test_files import temp_folder
from conans.test.utils.tools import TestClient
from conan.test.utils.scm import create_local_git_repo
from conan.test.utils.test_files import temp_folder
from conan.test.utils.tools import TestClient
from conans.util.files import save


Expand Down
10 changes: 5 additions & 5 deletions test/functional/command/test_install_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

import pytest

from conans.test.assets.cmake import gen_cmakelists
from conans.test.assets.genconanfile import GenConanfile
from conans.test.assets.sources import gen_function_cpp
from conans.test.utils.test_files import temp_folder
from conans.test.utils.tools import TestClient
from conan.test.assets.cmake import gen_cmakelists
from conan.test.assets.genconanfile import GenConanfile
from conan.test.assets.sources import gen_function_cpp
from conan.test.utils.test_files import temp_folder
from conan.test.utils.tools import TestClient
from conans.util.files import save


Expand Down
2 changes: 1 addition & 1 deletion test/functional/conanfile/runner_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import textwrap
import unittest

from conans.test.utils.tools import TestClient
from conan.test.utils.tools import TestClient


class RunnerTest(unittest.TestCase):
Expand Down
4 changes: 2 additions & 2 deletions test/functional/graph/test_graph_build_mode.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest
from conans.test.assets.genconanfile import GenConanfile
from conans.test.utils.tools import TestClient
from conan.test.assets.genconanfile import GenConanfile
from conan.test.utils.tools import TestClient


@pytest.fixture(scope="module")
Expand Down
2 changes: 1 addition & 1 deletion test/functional/graph/test_transitive_build_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest

from conans.test.utils.tools import TestClient
from conan.test.utils.tools import TestClient


@pytest.mark.tool("cmake")
Expand Down
Loading

0 comments on commit 0597c50

Please sign in to comment.