def test_new(self): env = _Environment() env.foo = 10 with env.new(): assert not hasattr(env, "foo") with env.new(foo=20): assert env.foo == 20
def test_scoping_rules(self): env = _Environment() env.foo = 10 with env.let(foo=20): assert env.foo == 20 env.foo = 30 # goes to global scope assert env.foo == 20 assert env.foo == 30
def test_disallow_let_static(self): env = _Environment() env._foo = 10 assert_raises(RuntimeError, env.let, _foo=10)
def test_let(self): env = _Environment() with env.let(foo=10): assert env.foo == 10
def test_update(self): env = _Environment() env2 = _Environment() env2.foo = 10 env.update(env2) assert env.foo == 10
def test_set(self): env = _Environment() env.foo = 10 assert env.foo == 10
# distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import os import sys import tempfile import shutil import argparse from nose import SkipTest from testmill.ravello import RavelloClient from testmill.state import env, _Environment testenv = _Environment() from testmill.test import networkblocker, sudo from testmill.test.fileops import * if sys.version_info[0] == 3: import configparser else: import ConfigParser as configparser __all__ = ('testenv', 'require_sudo', 'require_network_blocking', 'TestSuite', 'unittest', 'integrationtest', 'systemtest', 'tempdir', 'get_common_args', 'parse_ps_output', 'environ') testdir, _ = os.path.split(os.path.abspath(__file__))