Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion notebook/_version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
"""
store the current version info of the notebook.

"""

# Downstream maintainer, when running `python.setup.py jsversion`,
# the version string is propagated to the JavaScript files, do not forget to
# patch the JavaScript files in `.postN` release done by distributions.

# Next beta/alpha/rc release: The version number for beta is X.Y.ZbN **without dots**.

version_info = (4, 1, 0, 'b1')
__version__ = '.'.join(map(str, version_info))
__version__ = '.'.join(map(str, version_info[:3])) + ''.join(version_info[3:])
41 changes: 39 additions & 2 deletions notebook/tests/test_notebookapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import logging
import os
import re
from tempfile import NamedTemporaryFile

import nose.tools as nt
Expand All @@ -12,7 +13,7 @@
from jupyter_core.application import NoStart
from ipython_genutils.tempdir import TemporaryDirectory
from traitlets import TraitError
from notebook import notebookapp
from notebook import notebookapp, __version__
NotebookApp = notebookapp.NotebookApp


Expand Down Expand Up @@ -74,4 +75,40 @@ def test_generate_config():
with nt.assert_raises(NoStart):
app.start()
assert os.path.exists(os.path.join(td, 'jupyter_notebook_config.py'))



#test if the version testin function works
def test_pep440_version():

for version in [
'4.1.0.b1',
'4.1.b1',
'4.2',
'X.y.z',
'1.2.3.dev1.post2',
]:
def loc():
with nt.assert_raises(ValueError):
raise_on_bad_version(version)
yield loc

for version in [
'4.1.1',
'4.2.1b3',
]:

yield (raise_on_bad_version, version)



pep440re = re.compile('^(\d+)\.(\d+)\.(\d+((a|b|rc)\d+)?)(\.post\d+)?(\.dev\d+)?$')

def raise_on_bad_version(version):
if not pep440re.match(version):
raise ValueError("Versions String does apparently not match Pep 440 specification, "
"which might lead to sdist and wheel being seen as 2 different release. "
"E.g: do not use dots for beta/alpha/rc markers.")


def test_current_version():
raise_on_bad_version(__version__)