Permalink
Browse files

documentation, and less copy

  • Loading branch information...
sdpython committed Aug 28, 2018
1 parent a0554ab commit 44885ea41009c4928be23f787fa534f7393b14d7
Showing with 13 additions and 17 deletions.
  1. +4 −13 _unittests/ut_jsscripts/test_copy_tools.py
  2. +9 −4 src/code_beatrix/jsscripts/__init__.py
@@ -6,7 +6,7 @@
import os
import unittest
import warnings
from pyquickhelper.loghelper import fLOG
from pyquickhelper.pycode import skipif_travis, ExtTestCase
try:
@@ -26,26 +26,17 @@
from src.code_beatrix.jsscripts import copy_jstool2notebook
class TestCopyTools(unittest.TestCase):
class TestCopyTools(ExtTestCase):
@skipif_travis("travis, unable to test TestCopyTools.test_copy_tools")
def test_copy_tools(self):
fLOG(
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")
if "travis" in sys.executable:
warnings.warn(
"travis, unable to test TestCopyTools.test_copy_tools")
return
try:
res = copy_jstool2notebook("snap")
except PermissionError as e:
warnings.warn(
"Cannot copy, user has no permission to modify python distribution {0}".format(e))
return
assert isinstance(res, list)
self.assertIsInstance(res, list)
if __name__ == "__main__":
@@ -1,17 +1,18 @@
"""
@file
@brief Copy files to the proper location.
@brief Copies files to the proper location.
"""
import os
from pyquickhelper.filehelper import synchronize_folder
def copy_jstool2notebook(tool):
def copy_jstool2notebook(tool, force=False):
"""
copy a tool to ipython folder
Copies a tool to :epkg:`notebook` folder.
@param tool tool name (snap for example)
@param force do the copy even if the destination folder exists
@return list of copied files
"""
import notebook
@@ -22,4 +23,8 @@ def copy_jstool2notebook(tool):
dest = os.path.join(dest, tool)
if not os.path.exists(dest):
os.mkdir(dest)
return synchronize_folder(src, dest)
return synchronize_folder(src, dest)
elif force:
return synchronize_folder(src, dest)
else:
return None

0 comments on commit 44885ea

Please sign in to comment.