How to use unset_env method in pytest-cov

Best Python code snippet using pytest-cov

terraform.py

Source: terraform.py Github

copy

Full Screen

...45 def set_env(self, name: str, value: str):46 if 'env' not in self._global_call_kwargs:47 self._global_call_kwargs['env'] = {}48 self._global_call_kwargs['env'][name] = value49 def unset_env(self, name: str):50 if 'env' in self._global_call_kwargs:51 self._global_call_kwargs['env'].pop(name)52 def set_TF_LOG(self, value: str):53 self.set_env('TF_LOG', value)54 def unset_TF_LOG(self):55 self.unset_env('TF_LOG')56 def set_TF_LOG_PATH(self, value: str):57 self.set_env('TF_LOG_PATH', value)58 def unset_TF_LOG_PATH(self):59 self.unset_env('TF_LOG_PATH')60 def set_TF_INPUT(self, value: str):61 self.set_env('TF_INPUT', value)62 def unset_TF_INPUT(self):63 self.unset_env('TF_INPUT')64 def set_TF_VAR_(self, name: str, value: str):65 self.set_env(f'TF_VAR_{name}', value)66 def unset_TF_VAR_(self, name: str):67 self.unset_env(f'TF_VAR_{name}')68 def set_TF_CLI_ARGS(self, value: str):69 self.set_env('TF_CLI_ARGS', value)70 def unset_TF_CLI_ARGS(self):71 self.unset_env('TF_CLI_ARGS')72 def set_TF_CLI_ARGS_(self, name: str, value: str):73 self.set_env(f'TF_CLI_ARGS_{name}', value)74 def unset_TF_CLI_ARGS_(self, name: str):75 self.unset_env(f'TF_CLI_ARGS_{name}')76 def set_TF_DATA_DIR(self, value: str):77 self.set_env('TF_DATA_DIR', value)78 def unset_TF_DATA_DIR(self):79 self.unset_env('TF_DATA_DIR')80 def set_TF_WORKSPACE(self, value: str):81 self.set_env('TF_WORKSPACE', value)82 def unset_TF_WORKSPACE(self):83 self.unset_env('TF_WORKSPACE')84 def set_TF_IN_AUTOMATION(self):85 self.set_env('TF_IN_AUTOMATION', 'true')86 def unset_TF_IN_AUTOMATION(self):87 self.unset_env('TF_IN_AUTOMATION')88 def set_TF_REGISTRY_DISCOVERY_RETRY(self, value: str):89 self.set_env('TF_REGISTRY_DISCOVERY_RETRY', value)90 def unset_TF_REGISTRY_DISCOVERY_RETRY(self):91 self.unset_env('TF_REGISTRY_DISCOVERY_RETRY')92 def set_TF_REGISTRY_CLIENT_TIMEOUT(self, value: str):93 self.set_env('TF_REGISTRY_CLIENT_TIMEOUT', value)94 def unset_TF_REGISTRY_CLIENT_TIMEOUT(self):95 self.unset_env('TF_REGISTRY_CLIENT_TIMEOUT')96 def set_TF_CLI_CONFIG_FILE(self, value: str):97 self.set_env('TF_CLI_CONFIG_FILE', value)98 def unset_TF_CLI_CONFIG_FILE(self):99 self.unset_env('TF_CLI_CONFIG_FILE')100 def set_TF_IGNORE(self, value: str):101 self.set_env('TF_IGNORE', value)102 def unset_TF_IGNORE(self):103 self.unset_env('TF_IGNORE')104 def auto_approve(self, value: bool = True):105 self._auto_approve = value106 def auto_approve_apply(self, value: bool = True):107 self._auto_approve_apply = value108 def auto_approve_destroy(self, value: bool = True):109 self._auto_approve_destroy = value110 def set_var(self, name: str, value: any):111 self._var[name] = value112 def unset_var(self, name: str):113 self._var.pop(name)114 def init(self, *args: ArgType, call_kwargs: Optional[dict] = None, **kwargs):115 """Prepare your working directory for other commands"""116 return self._run(['init'], *args, call_kwargs=call_kwargs, **kwargs)117 def validate(self, *args: ArgType, call_kwargs: Optional[dict] = None, **kwargs):...

Full Screen

Full Screen

provider.py

Source: provider.py Github

copy

Full Screen

...34_all_providers = [*_generic_providers, *_specific_providers]35def provider_sum():36 """Return number of |Provider|'s that return ``True``."""37 return sum([provider() for provider in Provider._all_provider_functions])38@unset_env(*_all_providers)39def test_provider_is_ci():40 """41 Validate |is_ci| reports as expected.42 .. |is_ci| replace:: :func:`Provider.is_ci() <ci_exec.provider.Provider.is_ci>`43 """44 assert not Provider.is_ci()45 # Test individual generic providers report success.46 for generic in _generic_providers:47 generic_map = {generic: "true"}48 with set_env(**generic_map):49 assert Provider.is_ci()50 # Test both being set report success.51 full_generic_map = {generic: "true" for generic in _generic_providers}52 with set_env(**full_generic_map):53 assert Provider.is_ci()54 # Test that setting specific provider(s) also reports success. This should also be55 # tested in each specific provider test below.56 full_provider_map = {}57 for provider in ["APPVEYOR", "CIRCLECI", "TRAVIS"]:58 provider_map = {provider: "true"}59 with set_env(**provider_map):60 assert Provider.is_ci()61 full_provider_map[provider] = "true"62 with set_env(**full_provider_map):63 assert Provider.is_ci()64@unset_env(*_all_providers)65def test_provider_is_appveyor():66 """67 Validate |is_appveyor| reports as expected.68 .. |is_appveyor| replace::69 :func:`Provider.is_appveyor() <ci_exec.provider.Provider.is_appveyor>`70 """71 assert not Provider.is_ci()72 assert not Provider.is_appveyor()73 with set_env(APPVEYOR="true"):74 assert Provider.is_ci()75 assert Provider.is_appveyor()76 assert provider_sum() == 177@unset_env(*_all_providers)78def test_provider_is_azure_pipelines():79 """80 Validate |is_azure_pipelines| reports as expected.81 .. |is_azure_pipelines| replace::82 :func:`Provider.is_azure_pipelines() <ci_exec.provider.Provider.is_azure_pipelines>`83 """ # noqa: E50184 assert not Provider.is_ci()85 assert not Provider.is_azure_pipelines()86 with set_env(AZURE_HTTP_USER_AGENT="dontcare"):87 assert not Provider.is_ci()88 assert not Provider.is_azure_pipelines()89 with set_env(AGENT_NAME="dontcare"):90 assert not Provider.is_ci()91 assert not Provider.is_azure_pipelines()92 with set_env(BUILD_REASON="dontcare"):93 assert Provider.is_ci()94 assert Provider.is_azure_pipelines()95 assert provider_sum() == 196@unset_env(*_all_providers)97def test_provider_is_circle_ci():98 """99 Validate |is_circle_ci| reports as expected.100 .. |is_circle_ci| replace::101 :func:`Provider.is_circle_ci() <ci_exec.provider.Provider.is_circle_ci>`102 """103 assert not Provider.is_ci()104 assert not Provider.is_circle_ci()105 with set_env(CIRCLECI="true"):106 assert Provider.is_ci()107 assert Provider.is_circle_ci()108 assert provider_sum() == 1109@unset_env(*_all_providers)110def test_provider_is_github_actions():111 """112 Validate |is_github_actions| reports as expected.113 .. |is_github_actions| replace::114 :func:`Provider.is_github_actions <ci_exec.provider.Provider.is_github_actions>`115 """116 assert not Provider.is_ci()117 assert not Provider.is_github_actions()118 with set_env(GITHUB_ACTIONS="true"):119 assert Provider.is_ci()120 assert Provider.is_github_actions()121 assert provider_sum() == 1122@unset_env(*_all_providers)123def test_provider_is_jenkins():124 """125 Validate |is_jenkins| reports as expected.126 .. |is_jenkins| replace::127 :func:`Provider.is_jenkins() <ci_exec.provider.Provider.is_jenkins>`128 """129 assert not Provider.is_ci()130 assert not Provider.is_jenkins()131 with set_env(JENKINS_URL="dontcare"):132 assert not Provider.is_ci()133 assert not Provider.is_jenkins()134 with set_env(BUILD_NUMBER="dontcare"):135 assert Provider.is_ci()136 assert Provider.is_jenkins()137 assert provider_sum() == 1138@unset_env(*_all_providers)139def test_provider_is_travis():140 """141 Validate |is_travis| reports as expected.142 .. |is_travis| replace::143 :func:`Provider.is_travis() <ci_exec.provider.Provider.is_travis>`144 """145 assert not Provider.is_ci()146 assert not Provider.is_travis()147 with set_env(TRAVIS="true"):148 assert Provider.is_ci()149 assert Provider.is_travis()...

Full Screen

Full Screen

commands.py

Source: commands.py Github

copy

Full Screen

...74 @abc.abstractmethod75 def set_env(self, var, value):76 raise NotImplementedError77 @abc.abstractmethod78 def unset_env(self, var):79 raise NotImplementedError80 @abc.abstractmethod81 def cd(self, path):82 raise NotImplementedError83 @abc.abstractmethod84 def pushd(self, path):85 raise NotImplementedError86 @abc.abstractmethod87 def popd(self):88 raise NotImplementedError89 @abc.abstractmethod90 def cat(self):91 raise NotImplementedError92class BatchCommands(ShellCommands):93 shell = 'cmd.exe'94 def execute(self, expression):95 return f('call {expression}')96 def echo(self, message):97 return f('echo {message}')98 def set(self, var, value):99 return f('set "{var}={value}"')100 def unset(self, var):101 return f('set "{var}="')102 set_env = set103 unset_env = unset104 def cd(self, path):105 path = ntpath.normpath(path)106 return f('cd {path}')107 def pushd(self, path):108 path = ntpath.normpath(path)109 return f('pushd {path}')110 def popd(self):111 return 'popd'112 def cat(self, path):113 path = ntpath.normpath(path)114 return f('type {path}')115class PowershellCommands(ShellCommands):116 shell = 'powershell.exe'117 def execute(self, expression):118 return f('Invoke-Expression {expression}')119 def echo(self, message):120 return f('Write-Host {message}')121 def set(self, var, value):122 return f('${var}={value}')123 def unset(self, var, value):124 return f('Remove-Variable {var}')125 def set_env(self, var, value):126 return f('$env:{var}={value}')127 def unset_env(self, var, value):128 return f('Remove-Item Env:{var}')129 def cd(self, path):130 path = ntpath.normpath(path)131 return f('cd {path}')132 def pushd(self, path):133 path = ntpath.normpath(path)134 return f('Push-Location -Path "{path}"')135 def popd(self):136 return 'Pop-Location'137 def cat(self, path):138 path = ntpath.normpath(path)139 return f('Get-Content {path}')140class BashCommands(ShellCommands):141 shell = 'bash'142 def execute(self, expression):143 return f('$({expression})')144 def echo(self, message):145 return f('echo {message}')146 def set(self, var, value):147 return f('{var}={value}')148 def unset(self, var):149 return f('unset {var}')150 def set_env(self, var, value):151 return f('export {var}={value}')152 def unset_env(self, var):153 return f('unset {var}')154 def cd(self, path):155 path = posixpath.normpath(path)156 return f('cd {path}')157 def pushd(self, path):158 path = posixpath.normpath(path)159 return f('pushd {path}')160 def popd(self):161 return 'popd'162 def cat(self, path):163 path = posixpath.normpath(path)164 return f('cat {path}')...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

Different Ways To Style CSS Box Shadow Effects

Have you ever visited a website that only has plain text and images? Most probably, no. It’s because such websites do not exist now. But there was a time when websites only had plain text and images with almost no styling. For the longest time, websites did not focus on user experience. For instance, this is how eBay’s homepage looked in 1999.

Now Log Bugs Using LambdaTest and DevRev

In today’s world, an organization’s most valuable resource is its customers. However, acquiring new customers in an increasingly competitive marketplace can be challenging while maintaining a strong bond with existing clients. Implementing a customer relationship management (CRM) system will allow your organization to keep track of important customer information. This will enable you to market your services and products to these customers better.

Get A Seamless Digital Experience With #LambdaTestYourBusiness????

The holidays are just around the corner, and with Christmas and New Year celebrations coming up, everyone is busy preparing for the festivities! And during this busy time of year, LambdaTest also prepped something special for our beloved developers and testers – #LambdaTestYourBusiness

A Complete Guide To CSS Container Queries

In 2007, Steve Jobs launched the first iPhone, which revolutionized the world. But because of that, many businesses dealt with the problem of changing the layout of websites from desktop to mobile by delivering completely different mobile-compatible websites under the subdomain of ‘m’ (e.g., https://m.facebook.com). And we were all trying to figure out how to work in this new world of contending with mobile and desktop screen sizes.

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run pytest-cov automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful