Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix skipped tests & remove deprecation warnings #6018

Merged
merged 2 commits into from
Mar 24, 2021
Merged
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
38 changes: 18 additions & 20 deletions notebook/tests/test_notebookapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,38 +90,36 @@ def test_generate_config():
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 [
@pytest.mark.parametrize(
'version', [
'4.1.0.b1',
'4.1.b1',
'4.2',
'X.y.z',
'1.2.3.dev1.post2',
]:
def loc():
with pytest.raises(ValueError):
raise_on_bad_version(version)
yield loc

for version in [
]
)
def test_pep440_bad_version(version):
with pytest.raises(ValueError):
raise_on_bad_version(version)

@pytest.mark.parametrize(
'version', [
'4.1.1',
'4.2.1b3',
]:

yield (raise_on_bad_version, version)
]
)
def test_pep440_good_version(version):
raise_on_bad_version(version)



pep440re = re.compile('^(\d+)\.(\d+)\.(\d+((a|b|rc)\d+)?)(\.post\d+)?(\.dev\d*)?$')
pep440re = re.compile(r'^(\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__)

Expand All @@ -139,7 +137,7 @@ def test_notebook_password():
assert nb.password != ''
passwd_check(nb.password, password)

class TestingStopApp(notebookapp.NbserverStopApp):
class StopAppTest(notebookapp.NbserverStopApp):
"""For testing the logic of NbserverStopApp."""
def __init__(self, **kwargs):
super().__init__(**kwargs)
Expand Down Expand Up @@ -168,15 +166,15 @@ def list_running_servers(runtime_dir):

# test stop with a match
with mock_servers:
app = TestingStopApp()
app = StopAppTest()
app.initialize(['105'])
app.start()
assert len(app.servers_shut_down) == 1
assert app.servers_shut_down[0]['port'] == 105

# test no match
with mock_servers, patch('os.kill') as os_kill:
app = TestingStopApp()
app = StopAppTest()
app.initialize(['999'])
with pytest.raises(SystemExit) as exc:
app.start()
Expand Down