Skip to content

Commit

Permalink
Merge pull request #294 from rstudio/mm-update
Browse files Browse the repository at this point in the history
Dependabot updates
  • Loading branch information
mmarchetti authored May 26, 2021
2 parents c931e51 + e95b537 commit 309cc6e
Show file tree
Hide file tree
Showing 13 changed files with 687 additions and 517 deletions.
8 changes: 7 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,15 @@ wheel = "*"
[packages]
nbconvert = ">=5.0"
nbformat = "*"
notebook = "*"
notebook = ">=6.1.5"
rsconnect-python = ">=1.5.0"
six = "*"
# Dependabot fixes
py = ">=1.10.0"
Pygments = ">=2.7.4"
jinja2 = ">=2.11.3"
bleach = ">=3.3.0"
cryptography = ">=3.2"

[pipenv]
allow_prereleases = true
1,084 changes: 620 additions & 464 deletions Pipfile.lock

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions rsconnect_jupyter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ def post(self, action):
except Exception as err:
self.log.exception("Unable to verify that the provided server is running RStudio Connect")
raise web.HTTPError(
400, u"Unable to verify that the provided server is running RStudio Connect: %s" % err,
400,
u"Unable to verify that the provided server is running RStudio Connect: %s" % err,
)
if canonical_address is not None:
uri = canonical_address.url
Expand Down Expand Up @@ -177,7 +178,8 @@ def post(self, action):
raise web.HTTPError(500, u"Bundle creation failed: %s" % exc)
else:
raise web.HTTPError(
400, 'Invalid app_mode: %s, must be "static" or "jupyter-static"' % app_mode,
400,
'Invalid app_mode: %s, must be "static" or "jupyter-static"' % app_mode,
)

try:
Expand Down
53 changes: 32 additions & 21 deletions selenium/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,24 @@ def pytest_addoption(parser):
"""Define and parse command line options"""

parser.addoption(
"--selene-reports", action=ReportsAction, help="parent directory for storing selene test reports",
"--selene-reports",
action=ReportsAction,
help="parent directory for storing selene test reports",
)

parser.addoption(
"--selene-timeout", action=TimeoutAction, default=4, type=int, help="set the default timeout in selene",
"--selene-timeout",
action=TimeoutAction,
default=4,
type=int,
help="set the default timeout in selene",
)

parser.addoption(
"--jupyter-url", action="store", default="http://jupyter-py2/", help="URI of the Jupyter system under test",
"--jupyter-url",
action="store",
default="http://jupyter-py2/",
help="URI of the Jupyter system under test",
)

parser.addoption(
Expand All @@ -65,11 +74,17 @@ def pytest_addoption(parser):
)

parser.addoption(
"--data-dir", action="store", default="/selenium/data", help="Directory where data files are stored",
"--data-dir",
action="store",
default="/selenium/data",
help="Directory where data files are stored",
)

parser.addoption(
"--notebooks-dir", action="store", default="/notebooks", help="Directory where Jupyter Notebooks are stored",
"--notebooks-dir",
action="store",
default="/notebooks",
help="Directory where Jupyter Notebooks are stored",
)


Expand All @@ -80,7 +95,9 @@ def log_web_error(msg):
when using Python's `assert` keyword to perform assertions.
"""

screenshot = selene.helpers.take_screenshot(selene.browser.driver(),)
screenshot = selene.helpers.take_screenshot(
selene.browser.driver(),
)
msg = """{original_msg}
screenshot: file://{screenshot}""".format(
original_msg=msg, screenshot=screenshot
Expand All @@ -90,32 +107,28 @@ def log_web_error(msg):

@pytest.fixture(scope="session")
def jupyter_url(request):
"""Retrieve the url of the system under test
"""
"""Retrieve the url of the system under test"""

return request.config.getoption("--jupyter-url")


@pytest.fixture(scope="session")
def connect_url(request):
"""Retrieve the url of the Connect server where content is deployed
"""
"""Retrieve the url of the Connect server where content is deployed"""

return request.config.getoption("--connect-url")


@pytest.fixture(scope="session")
def data_dir(request):
"""Retrieve the directory where data files, used in tests, are stored
"""
"""Retrieve the directory where data files, used in tests, are stored"""

return request.config.getoption("--data-dir")


@pytest.fixture(scope="session")
def notebooks_dir(request):
"""Retrieve the directory where notebooks for the Jupyer server are stored
"""
"""Retrieve the directory where notebooks for the Jupyer server are stored"""

return request.config.getoption("--notebooks-dir")

Expand All @@ -136,17 +149,16 @@ def browser_config(driver):


def generate_random_string(
length=8, charset="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()",
length=8,
charset="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()",
):
"""Randomly pick chars from an alphabet
"""
"""Randomly pick chars from an alphabet"""

return "".join(secrets.choice(charset) for i in range(length))


def generate_content_name():
"""Generate random application name
"""
"""Generate random application name"""

# start with a letter for safety

Expand All @@ -160,8 +172,7 @@ def generate_content_name():

@pytest.fixture(scope="function")
def notebook(data_dir, notebooks_dir):
"""Create a new, never deployed notebook
"""
"""Create a new, never deployed notebook"""

# file that will be used to generate the new notebook
template_path = os.path.join(data_dir, "spiro.ipynb")
Expand Down
12 changes: 7 additions & 5 deletions selenium/t/test_add_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
class TestAddServer(object):
@pytest.fixture(autouse=True)
def setup(self, browser_config, jupyter_url, notebook):
"""Navigate to the front page
"""
"""Navigate to the front page"""

self.notebook = notebook

Expand All @@ -32,8 +31,7 @@ def setup(self, browser_config, jupyter_url, notebook):
MainToolBar().rsconnect_publish.click()

def test_valid_address_valid_name(self, connect_url):
"""Fill in the add server form with valid address and name
"""
"""Fill in the add server form with valid address and name"""

server_name = generate_random_string()
api_key = "0123456789abcdef0123456789abcdef"
Expand All @@ -42,7 +40,11 @@ def test_valid_address_valid_name(self, connect_url):
sleep(1)

AddServerForm().populate_form(
{"address": connect_url, "api_key": api_key, "name": server_name,}
{
"address": connect_url,
"api_key": api_key,
"name": server_name,
}
)

AddServerForm().submit_form()
Expand Down
3 changes: 1 addition & 2 deletions selenium/t/test_publish_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ def setup(self, browser_config, jupyter_url, notebook, connect_url):
MainToolBar().rsconnect_publish.click()

def test_publish_source(self, connect_url):
"""Publish a document with source
"""
"""Publish a document with source"""
pf = PublishContentForm()
# dialog is racy with event setup
sleep(1)
Expand Down
6 changes: 2 additions & 4 deletions selenium/t/test_publish_static.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
class TestPublishStatic(object):
@pytest.fixture(autouse=True)
def setup(self, browser_config, jupyter_url, notebook, connect_url):
"""Navigate to the front page
"""
"""Navigate to the front page"""

self.notebook = notebook

Expand All @@ -28,8 +27,7 @@ def setup(self, browser_config, jupyter_url, notebook, connect_url):
MainToolBar().rsconnect_publish.click()

def test_publish_static(self, connect_url):
"""Publish a static document
"""
"""Publish a static document"""
pf = PublishContentForm()
# dialog is racy with event setup
sleep(1)
Expand Down
6 changes: 2 additions & 4 deletions selenium/t/test_republish.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
class TestRepublish(object):
@pytest.fixture(autouse=True)
def setup(self, browser_config, jupyter_url, notebook, connect_url):
"""Navigate to the front page
"""
"""Navigate to the front page"""

self.notebook = notebook

Expand All @@ -29,8 +28,7 @@ def setup(self, browser_config, jupyter_url, notebook, connect_url):
MainToolBar().rsconnect_publish.click()

def test_republish(self, connect_url):
"""Publish a static document
"""
"""Publish a static document"""
pf = PublishContentForm()
sleep(1) # dialog is racy with event setup

Expand Down
6 changes: 2 additions & 4 deletions selenium/t/test_switch_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
class TestSwitchMode(object):
@pytest.fixture(autouse=True)
def setup(self, browser_config, jupyter_url, notebook, connect_url):
"""Navigate to the front page
"""
"""Navigate to the front page"""

self.notebook = notebook

Expand All @@ -28,8 +27,7 @@ def setup(self, browser_config, jupyter_url, notebook, connect_url):
MainToolBar().rsconnect_publish.click()

def test_switch_mode(self, connect_url):
"""Publish a static document
"""
"""Publish a static document"""
pf = PublishContentForm()
sleep(1) # dialog is racy with event setup

Expand Down
5 changes: 4 additions & 1 deletion selenium/tools/systemstat/gridstat.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ def is_ready(self):
# response was not "ok", log error details
self.logger.info(
'hub responded at "{}" with error:\n{}\n{}\n{}'.format(
grid_api_hub_url, response.status_code, response.headers, response.text,
grid_api_hub_url,
response.status_code,
response.headers,
response.text,
)
)

Expand Down
3 changes: 1 addition & 2 deletions selenium/tools/systemstat/sutstat.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ def __init__(self, url="http://localhost:6969", sleep=5.0, wait=60, **kwargs):
self.logger.info("url: {}".format(url))

def is_ready(self):
"""check if the system is ready (accepting requests)
"""
"""check if the system is ready (accepting requests)"""

ping_url = self._url + "/"

Expand Down
6 changes: 2 additions & 4 deletions selenium/tools/systemstat/test_systemstat.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ def test_default_command_fxn(self):
assert tool._iterations == 1

def test_system_up_no_waiting(self):
"""if is_ready() returns True, wait_until_ready() doesn't wait.
"""
"""if is_ready() returns True, wait_until_ready() doesn't wait."""

class MySystemStatTool(SystemStatTool):
def __init__(self):
Expand All @@ -62,8 +61,7 @@ def is_ready(self):
assert tool._iterations == 1

def test_delay_systemup(self):
"""wait_until_ready() waits and polls while system is down.
"""
"""wait_until_ready() waits and polls while system is down."""

class MySystemStatTool(SystemStatTool):
def __init__(self):
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -543,9 +543,9 @@ levn@^0.3.0, levn@~0.3.0:
type-check "~0.3.2"

lodash@^4.17.14, lodash@^4.17.15:
version "4.17.15"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"
integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==

mimic-fn@^2.1.0:
version "2.1.0"
Expand Down

0 comments on commit 309cc6e

Please sign in to comment.