Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fperez committed Dec 12, 2017
1 parent 264eb4c commit 250f881
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*~
.#*
[#]*#
.DS_Store
__pycache__
.cache
.coverage
.ipynb_checkpoints
12 changes: 5 additions & 7 deletions copip.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

# Stdlib imports

import shutil
import os
import sys
import typing as T

Expand All @@ -21,7 +21,6 @@
COPIP_ON = Path('copipon.sh')
COPIP_OFF = Path('copipoff.sh')

#print(__file__); sys.exit(1)

# Function definitions
def main(args: T.Optional[list]=None) -> int:
Expand Down Expand Up @@ -50,7 +49,7 @@ def main(args: T.Optional[list]=None) -> int:
for script, cdir in [(COPIP_ON, acti_dir), (COPIP_OFF, deac_dir)]:
dest = cdir/script
if not dest.is_file():
shutil.copy(COPIP_DIR/script, dest)
os.link(COPIP_DIR/script, dest)

print(f"Environment dev overlay `{ename}` ready at `{copip_dir}`")

Expand All @@ -73,7 +72,7 @@ def test_normal():
sh = functools.partial(subprocess.run, shell=True, check=True)

ename = '__tmp_copip_env__'
copip = copip_BASE/ename
copip = CONDA_BASE/ename
sh(f"conda create -n {ename} --yes")
try:
assert main([ename]) == 0
Expand All @@ -82,10 +81,9 @@ def test_normal():
for script, cdir in [(COPIP_ON, 'activate.d'),
(COPIP_OFF, 'deactivate.d')]:
src = CONDA_BASE/ename/'etc/conda'/cdir/script
assert src.is_symlink()
assert src.samefile(script)
assert src.is_file()
assert src.samefile(COPIP_DIR/script)
finally:
copip.rmdir()
sh(f"conda remove -n {ename} --all --yes")


Expand Down

0 comments on commit 250f881

Please sign in to comment.