Merge pull request #1728 from minrk/appveyor

[WIP] add appveyor.yml to start running tests on Windows
Thomas Kluyver 10 years ago committed by GitHub
commit 179bb24fbf

@ -0,0 +1,26 @@
# miniconda bootstrap from conda-forge recipe
matrix:
fast_finish: true
environment:
CONDA_INSTALL_LOCN: "C:\\conda"
matrix:
- CONDA_PY: 35
- CONDA_PY: 27
platform:
- x64
build: off
install:
- appveyor DownloadFile "https://raw.githubusercontent.com/pelson/Obvious-CI/master/bootstrap-obvious-ci-and-miniconda.py"
- cmd: python bootstrap-obvious-ci-and-miniconda.py %CONDA_INSTALL_LOCN% %platform% %CONDA_PY:~0,1% --without-obvci
- cmd: call %CONDA_INSTALL_LOCN%\Scripts\activate.bat
- cmd: conda config --set show_channel_urls true
- cmd: conda config --add channels conda-forge
- cmd: conda install -y pyzmq tornado jupyter_client nbformat nbconvert ipykernel pip nodejs nose
- cmd: pip install .[test]
test_script:
- nosetests --exclude-dir notebook\terminal -v notebook

@ -24,9 +24,14 @@ from . import tz
from notebook.utils import (
is_hidden,
to_api_path,
same_file,
)
try:
from os.path import samefile
except ImportError:
# windows + py2
from notebook.utils import samefile_simple as samefile
_script_exporter = None
@ -123,7 +128,7 @@ class FileContentsManager(FileManagerMixin, ContentsManager):
self.log.error("Post-save hook failed o-n %s", os_path, exc_info=True)
raise web.HTTPError(500, u'Unexpected error while running post hook save: %s' % e)
@validate('root_dir')
@validate('root_dir')
def _validate_root_dir(self, proposal):
"""Do a bit of validation of the root_dir."""
value = proposal['value']
@ -469,7 +474,7 @@ class FileContentsManager(FileManagerMixin, ContentsManager):
old_os_path = self._get_os_path(old_path)
# Should we proceed with the move?
if os.path.exists(new_os_path) and not same_file(old_os_path, new_os_path):
if os.path.exists(new_os_path) and not samefile(old_os_path, new_os_path):
raise web.HTTPError(409, u'File already exists: %s' % new_path)
# Move the file

@ -21,6 +21,7 @@ from tornado.ioloop import IOLoop
import zmq
import jupyter_core.paths
from traitlets.config import Config
from ..notebookapp import NotebookApp
from ipython_genutils.tempdir import TemporaryDirectory
@ -85,6 +86,8 @@ class NotebookTestBase(TestCase):
cls.data_dir = data_dir
cls.runtime_dir = TemporaryDirectory()
cls.notebook_dir = TemporaryDirectory()
config = cls.config or Config()
config.NotebookNotary.db_file = ':memory:'
started = Event()
def start_thread():
@ -97,7 +100,7 @@ class NotebookTestBase(TestCase):
runtime_dir=cls.runtime_dir.name,
notebook_dir=cls.notebook_dir.name,
base_url=cls.url_prefix,
config=cls.config,
config=config,
allow_root=True,
)
# don't register signal handler during tests

@ -357,16 +357,17 @@ class TestInstallNBExtension(TestCase):
link = os.readlink(dest)
self.assertEqual(link, src)
@dec.skip_win32
def test_install_symlink_bad(self):
with self.assertRaises(ValueError):
install_nbextension("http://example.com/foo.js", symlink=True)
with TemporaryDirectory() as d:
zf = u'ƒ.zip'
zsrc = pjoin(d, zf)
with zipfile.ZipFile(zsrc, 'w') as z:
z.writestr("a.js", b"b();")
with self.assertRaises(ValueError):
install_nbextension(zsrc, symlink=True)
@ -376,7 +377,7 @@ class TestInstallNBExtension(TestCase):
zsrc = pjoin(d, zf)
with zipfile.ZipFile(zsrc, 'w') as z:
z.writestr("a.js", b"b();")
with self.assertRaises(ValueError):
install_nbextension(zsrc, destination='foo')

@ -65,9 +65,9 @@ def test_invalid_nb_dir():
app.notebook_dir = tf
def test_nb_dir_with_slash():
with TemporaryDirectory(suffix="_slash/") as td:
with TemporaryDirectory(suffix="_slash" + os.sep) as td:
app = NotebookApp(notebook_dir=td)
nt.assert_false(app.notebook_dir.endswith("/"))
nt.assert_false(app.notebook_dir.endswith(os.sep))
def test_nb_dir_root():
root = os.path.abspath(os.sep) # gets the right value on Windows, Posix

@ -141,11 +141,16 @@ def is_hidden(abs_path, abs_root=''):
return False
def same_file(path, other_path):
def samefile_simple(path, other_path):
"""
Check if path and other_path are hard links to the same file. This is a
utility implementation of Python's os.path.samefile which is not available
with Python 2.x and Windows.
Fill in for os.path.samefile when it is unavailable (Windows+py2).
Do a case-insensitive string comparison in this case
plus comparing the full stat result (including times)
because Windows + py2 doesn't support the stat fields
needed for identifying if it's the same file (st_ino, st_dev).
Only to be used if os.path.samefile is not available.
Parameters
-----------
@ -158,12 +163,13 @@ def same_file(path, other_path):
"""
path_stat = os.stat(path)
other_path_stat = os.stat(other_path)
return (path_stat.st_ino == other_path_stat.st_ino and
path_stat.st_dev == other_path_stat.st_dev)
return (path.lower() == other_path.lower()
and path_stat == other_path_stat)
def to_os_path(path, root=''):
"""Convert an API path to a filesystem path
If given, root will be prepended to the path.
root must be a filesystem path already.
"""

@ -157,6 +157,7 @@ extras_require = {
':sys_platform != "win32"': ['terminado>=0.3.3'],
'test:python_version == "2.7"': ['mock'],
'test': ['nose', 'coverage', 'requests', 'nose_warnings_filters'],
'test:sys_platform == "win32"': ['nose-exclude'],
}
if 'setuptools' in sys.modules:

Loading…
Cancel
Save