Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
franramirez688 committed Oct 24, 2024
1 parent 1c29905 commit c99a1b8
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 34 deletions.
2 changes: 2 additions & 0 deletions test/functional/toolchains/cmake/test_cmake_toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,8 @@ def test_cmake_toolchain_runtime_types_cmake_older_than_3_15():

@pytest.mark.skipif(platform.system() != "Windows", reason="Only for windows")
class TestWinSDKVersion:

@pytest.mark.tool("visual_studio", "17")
def test_cmake_toolchain_winsdk_version(self):
# This test passes also with CMake 3.28, as long as cmake_minimum_required(VERSION 3.27)
# is not defined
Expand Down
1 change: 1 addition & 0 deletions test/functional/toolchains/cmake/test_ninja.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def test_locally_build_linux(build_type, shared, client):

@pytest.mark.skipif(platform.system() != "Windows", reason="Only windows")
@pytest.mark.parametrize("build_type,shared", [("Release", False), ("Debug", True)])
@pytest.mark.tool("visual_studio", "15")
@pytest.mark.tool("ninja")
def test_locally_build_msvc(build_type, shared, client):
msvc_version = "15"
Expand Down
41 changes: 41 additions & 0 deletions test/functional/toolchains/microsoft/test_vcvars.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import platform
import textwrap

import pytest

from conan.test.utils.tools import TestClient


@pytest.mark.skipif(platform.system() != "Windows", reason="Requires Windows")
@pytest.mark.tool("visual_studio", "17")
def test_deactivate_vcvars_message():
client = TestClient()
conanfile = textwrap.dedent("""
from conan import ConanFile
class TestConan(ConanFile):
generators = "VCVars"
settings = "os", "compiler", "arch", "build_type"
""")
client.save({"conanfile.py": conanfile})
client.run('install . -s compiler.version=193')
client.run_command(r'conanbuild.bat')
assert "[vcvarsall.bat] Environment initialized" in client.out
client.run_command(r'deactivate_conanvcvars.bat')
assert "vcvars env cannot be deactivated" in client.out


@pytest.mark.skipif(platform.system() != "Windows", reason="Requires Windows Powershell")
def test_deactivate_vcvars_with_powershell():
client = TestClient()
conanfile = textwrap.dedent("""
from conan import ConanFile
class TestConan(ConanFile):
generators = "VCVars"
settings = "os", "compiler", "arch", "build_type"
""")
client.save({"conanfile.py": conanfile})
client.run('install . -c tools.env.virtualenv:powershell=True')
client.run_command(r'powershell.exe ".\conanbuild.ps1"')
assert "conanvcvars.ps1: Activated environment" in client.out
client.run_command(r'powershell.exe ".\deactivate_conanvcvars.ps1"')
assert "vcvars env cannot be deactivated" in client.out
3 changes: 3 additions & 0 deletions test/integration/command_v2/test_cache_save_restore.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
import shutil
import tarfile
import time

import pytest

Expand Down Expand Up @@ -157,9 +158,11 @@ def test_cache_save_restore_multiple_revisions():
c = TestClient()
c.save({"conanfile.py": GenConanfile("pkg", "0.1")})
c.run("create .")
time.sleep(0.01)
rrev1 = c.exported_recipe_revision()
c.save({"conanfile.py": GenConanfile("pkg", "0.1").with_class_attribute("var=42")})
c.run("create .")
time.sleep(0.01)
rrev2 = c.exported_recipe_revision()
c.save({"conanfile.py": GenConanfile("pkg", "0.1").with_class_attribute("var=123")})
c.run("create .")
Expand Down
34 changes: 0 additions & 34 deletions test/integration/toolchains/microsoft/vcvars_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,37 +161,3 @@ class TestConan(ConanFile):

vcvars = client.load("conanvcvars.bat")
assert 'vcvarsall.bat" amd64 -vcvars_ver=14.33' in vcvars


@pytest.mark.skipif(platform.system() != "Windows", reason="Requires Windows")
def test_deactivate_vcvars_message():
client = TestClient()
conanfile = textwrap.dedent("""
from conan import ConanFile
class TestConan(ConanFile):
generators = "VCVars"
settings = "os", "compiler", "arch", "build_type"
""")
client.save({"conanfile.py": conanfile})
client.run('install . -s compiler.version=193')
client.run_command(r'conanbuild.bat')
assert "[vcvarsall.bat] Environment initialized" in client.out
client.run_command(r'deactivate_conanvcvars.bat')
assert "vcvars env cannot be deactivated" in client.out


@pytest.mark.skipif(platform.system() != "Windows", reason="Requires Windows Powershell")
def test_deactivate_vcvars_with_powershell():
client = TestClient()
conanfile = textwrap.dedent("""
from conan import ConanFile
class TestConan(ConanFile):
generators = "VCVars"
settings = "os", "compiler", "arch", "build_type"
""")
client.save({"conanfile.py": conanfile})
client.run('install . -c tools.env.virtualenv:powershell=True')
client.run_command(r'powershell.exe ".\conanbuild.ps1"')
assert "conanvcvars.ps1: Activated environment" in client.out
client.run_command(r'powershell.exe ".\deactivate_conanvcvars.ps1"')
assert "vcvars env cannot be deactivated" in client.out

0 comments on commit c99a1b8

Please sign in to comment.