Skip to content

Commit

Permalink
Fixes #36 - hashtree should not assume /tmp is on same filesystem; al…
Browse files Browse the repository at this point in the history
…so some test fixes
  • Loading branch information
jfischer committed Jul 7, 2019
1 parent 3f52900 commit f0c06c4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dataworkspaces/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Copyright 2018,2019 by MPI-SWS and Data-ken Research. Licensed under Apache 2.0. See LICENSE.txt.

__version__ = '1.0.6'
__version__ = '1.0.7'
3 changes: 2 additions & 1 deletion dataworkspaces/resources/hashtree.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from dataworkspaces.utils.subprocess_utils import call_subprocess
from dataworkspaces.utils.git_utils import GIT_EXE_PATH
from dataworkspaces.utils.file_utils import safe_rename

BUF_SIZE = 65536 # read stuff in 64kb chunks
def compute_hash(tmpname):
Expand Down Expand Up @@ -111,7 +112,7 @@ def write(self):
# that is the name of the file
objfile = os.path.join(self.path, self.hash)
os.chmod(tmpname, int('755', 8))
os.rename(tmpname, objfile)
safe_rename(tmpname, objfile)
if self.add_to_git:
call_subprocess([GIT_EXE_PATH, 'add', self.hash],
cwd=self.path, verbose=False)
Expand Down
8 changes: 7 additions & 1 deletion tests/test_jupyter_kit.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
CODE_DIR=join(WS_DIR, 'code')
NOTEBOOK='test_jupyter_kit.ipynb'

PYTHONPATH=os.path.abspath("..")

try:
JUPYTER=find_exe('jupyter', 'install Jupyter before running this test')
ERROR = None
Expand Down Expand Up @@ -58,7 +60,11 @@ def _run_dws(self, dws_args, cwd=WS_DIR, env=None, verbose=True):
def test_jupyter(self):
command = "%s nbconvert --to notebook --execute %s" % (JUPYTER, NOTEBOOK)
print(command)
r = subprocess.run(command, cwd=CODE_DIR, shell=True)
import copy
env=copy.copy(os.environ)
env['PYTHONPATH']=PYTHONPATH
print("set pythonpath to %s" % PYTHONPATH)
r = subprocess.run(command, cwd=CODE_DIR, shell=True, env=env)
r.check_returncode()
self._run_dws(['snapshot', '-m', "'snapshot of notebook run'", 'S1'],
verbose=False)
Expand Down

0 comments on commit f0c06c4

Please sign in to comment.