Skip to content

Commit

Permalink
Split config command tests a little
Browse files Browse the repository at this point in the history
  • Loading branch information
asmeurer committed Feb 7, 2014
1 parent 48b22b6 commit 2f21c13
Showing 1 changed file with 33 additions and 3 deletions.
36 changes: 33 additions & 3 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ def test_normalize_urls(self):
'https://your.repo/username/osx-64/',
])

test_condarc = os.path.join(os.path.dirname(__file__), 'test_condarc')
def _read_test_condarc():
test_condarc = os.path.join(os.path.dirname(__file__), 'test_condarc')
with open(test_condarc) as f:
return f.read()

# Tests for the conda config command
def test_config_command():
test_condarc = os.path.join(os.path.dirname(__file__), 'test_condarc')
def test_config_command_basics():

try:
# Test that creating the file adds the defaults channel
assert not os.path.exists('test_condarc')
Expand Down Expand Up @@ -142,6 +142,16 @@ def test_config_command():
"""
os.unlink(test_condarc)


finally:
try:
pass
os.unlink(test_condarc)
except OSError:
pass

def test_config_command_get():
try:
# Test --get
with open(test_condarc, 'w') as f:
f.write("""\
Expand Down Expand Up @@ -224,6 +234,16 @@ def test_config_command():

os.unlink(test_condarc)


finally:
try:
pass
os.unlink(test_condarc)
except OSError:
pass

def test_config_command_parser():
try:
# Now test the YAML "parser"
condarc = """\
channels : \n\
Expand Down Expand Up @@ -383,6 +403,16 @@ def test_config_command():
"""
os.unlink(test_condarc)


finally:
try:
pass
os.unlink(test_condarc)
except OSError:
pass

def test_config_command_remove_force():
try:
# Finally, test --remove, --remove-key, and --force (right now
# --remove and --remove-key require --force)
run_conda_command('config', '--file', test_condarc, '--add',
Expand Down

0 comments on commit 2f21c13

Please sign in to comment.