From e9f9d013932fb103865d727f96d48a451707c573 Mon Sep 17 00:00:00 2001 From: Xing Han Lu Date: Wed, 27 Feb 2019 23:22:46 -0500 Subject: [PATCH 01/16] :snowflake: Flake 8 on usage.py --- usage.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/usage.py b/usage.py index 4bdd7acf..cde948d0 100644 --- a/usage.py +++ b/usage.py @@ -9,9 +9,11 @@ cyto.Cytoscape( id='cytoscape', elements=[ - {'data': {'id': 'one', 'label': 'Node 1'}, 'position': {'x': 50, 'y': 50}}, - {'data': {'id': 'two', 'label': 'Node 2'}, 'position': {'x': 200, 'y': 200}}, - {'data': {'source': 'one', 'target': 'two','label': 'Node 1 to 2'}} + {'data': {'id': 'one', 'label': 'Node 1'}, + 'position': {'x': 50, 'y': 50}}, + {'data': {'id': 'two', 'label': 'Node 2'}, + 'position': {'x': 200, 'y': 200}}, + {'data': {'source': 'one', 'target': 'two', 'label': '1 to 2'}} ], layout={'name': 'preset'} ) From 44e1a2b5c55eee91481ec1e833f00ba8014b19c2 Mon Sep 17 00:00:00 2001 From: Xing Han Lu Date: Wed, 27 Feb 2019 23:24:22 -0500 Subject: [PATCH 02/16] IntegrationTests Class: decrease processes, increase window size, enable JS in percy --- tests/IntegrationTests.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/IntegrationTests.py b/tests/IntegrationTests.py index 1487a395..15707cef 100644 --- a/tests/IntegrationTests.py +++ b/tests/IntegrationTests.py @@ -20,8 +20,10 @@ class IntegrationTests(unittest.TestCase): def percy_snapshot(self, name=''): if os.environ.get('PERCY_ENABLED', False): snapshot_name = '{} - {}'.format(name, sys.version_info) + self.percy_runner.snapshot( - name=snapshot_name + name=snapshot_name, + enable_javascript=True ) @classmethod @@ -32,12 +34,11 @@ def setUpClass(cls): if 'DASH_TEST_CHROMEPATH' in os.environ: options.binary_location = os.environ['DASH_TEST_CHROMEPATH'] - cls.driver = webdriver.Chrome(chrome_options=options) + cls.driver = webdriver.Chrome(options=options) + cls.driver.set_window_size(1280, 1000) if os.environ.get('PERCY_ENABLED', False): - loader = percy.ResourceLoader( - webdriver=cls.driver - ) + loader = percy.ResourceLoader(webdriver=cls.driver) cls.percy_runner = percy.Runner(loader=loader) cls.percy_runner.initialize_build() @@ -64,7 +65,7 @@ def startServer(self, app): if 'DASH_TEST_PROCESSES' in os.environ: processes = int(os.environ['DASH_TEST_PROCESSES']) else: - processes = 4 + processes = 1 def run(): app.scripts.config.serve_locally = True From add4796eece199c4e2e3795dd487b7976b5004df Mon Sep 17 00:00:00 2001 From: Xing Han Lu Date: Wed, 27 Feb 2019 23:25:24 -0500 Subject: [PATCH 03/16] Add screenshots directory for tests Needed to auto-generate screenshots from test_usage.py, which will be then used in test_percy_snapshot for CVI --- .gitignore | 1 + tests/screenshots/readme.md | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 tests/screenshots/readme.md diff --git a/.gitignore b/.gitignore index 6ab50f9b..4ab8bf3c 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,7 @@ # Gradle .idea/**/gradle.xml .idea/**/libraries +tests/screenshots/*.png # misc .DS_Store diff --git a/tests/screenshots/readme.md b/tests/screenshots/readme.md new file mode 100644 index 00000000..3c56f45b --- /dev/null +++ b/tests/screenshots/readme.md @@ -0,0 +1,3 @@ +Please do not add unecessary files to this directory. This is reserved for auto-generated screenshots from testing. + +Please do not move this file. \ No newline at end of file From 0f402e599c6a194fe2f425896b09fc898dc7c1f6 Mon Sep 17 00:00:00 2001 From: Xing Han Lu Date: Wed, 27 Feb 2019 23:25:39 -0500 Subject: [PATCH 04/16] Update test requirements.txt --- tests/requirements.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/requirements.txt b/tests/requirements.txt index 6b543d12..92c7a3e3 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -13,3 +13,5 @@ selenium flake8 pylint pytest-dash>=1.0.1 +dash-cytoscape +colour==0.1.5 \ No newline at end of file From 5e9867c2918fd88f477e090fee5acee6b68c385d Mon Sep 17 00:00:00 2001 From: Xing Han Lu Date: Wed, 27 Feb 2019 23:26:55 -0500 Subject: [PATCH 05/16] Remove test_render To be broken down into different tests --- tests/test_render.py | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 tests/test_render.py diff --git a/tests/test_render.py b/tests/test_render.py deleted file mode 100644 index f494be94..00000000 --- a/tests/test_render.py +++ /dev/null @@ -1,25 +0,0 @@ -from .IntegrationTests import IntegrationTests -import dash -import dash_html_components as html -from selenium.webdriver.common.by import By -from selenium.webdriver.support.ui import WebDriverWait -from selenium.webdriver.support import expected_conditions as EC - -from dash_cytoscape import ExampleComponent # pylint: disable=no-name-in-module - - -class Tests(IntegrationTests): - def test_render_component(self): - app = dash.Dash(__name__) - app.layout = html.Div([ - html.Div(id='waitfor'), - ExampleComponent(label='Example Component Label') - ]) - - self.startServer(app) - - WebDriverWait(self.driver, 10).until( - EC.presence_of_element_located((By.ID, "waitfor")) - ) - - self.percy_snapshot('Simple Render') From e585146a8e98f197a9ac5f9acd36065547a00dc9 Mon Sep 17 00:00:00 2001 From: Xing Han Lu Date: Wed, 27 Feb 2019 23:27:38 -0500 Subject: [PATCH 06/16] Create test_usage.py for all usage apps Almost exhaustive test of many different types of apps, from the usage apps in root to the demos --- tests/test_usage.py | 73 ++++++++++++++++++++++++++++++--------------- 1 file changed, 49 insertions(+), 24 deletions(-) diff --git a/tests/test_usage.py b/tests/test_usage.py index 895835a8..4fa3ab1b 100644 --- a/tests/test_usage.py +++ b/tests/test_usage.py @@ -1,31 +1,56 @@ -from pytest_dash.utils import ( - import_app, - wait_for_text_to_equal, - wait_for_element_by_css_selector -) +import os +import importlib +from .IntegrationTests import IntegrationTests +from selenium.webdriver.common.by import By +from selenium.webdriver.support.ui import WebDriverWait +from selenium.webdriver.support import expected_conditions as EC -# Basic test for the component rendering. -def test_render_component(dash_threaded, selenium): - # Start a dash app contained in `usage.py` - # dash_threaded is a fixture by pytest-dash - # It will load a py file containing a Dash instance named `app` - # and start it in a thread. - app = import_app('usage') - dash_threaded(app) +class Tests(IntegrationTests): + def create_usage_test(self, filename): + app = importlib.import_module(filename).app - # Get the generated component input with selenium - # The html input will be a children of the #input dash component - my_component = wait_for_element_by_css_selector(selenium, '#input > input') + self.startServer(app) - assert 'my-value' == my_component.get_attribute('value') + WebDriverWait(self.driver, 20).until( + EC.presence_of_element_located((By.ID, "cytoscape")) + ) - # Clear the input - my_component.clear() + self.driver.save_screenshot(os.path.join( + os.path.dirname(__file__), + 'screenshots', + filename + '.png' + )) - # Send keys to the custom input. - my_component.send_keys('Hello dash') + def test_usage_advanced(self): + self.create_usage_test('usage-advanced') - # Wait for the text to equal, if after the timeout (default 10 seconds) - # the text is not equal it will fail the test. - wait_for_text_to_equal(selenium, '#output', 'You have entered Hello dash') + def test_usage_animated_bfs(self): + self.create_usage_test('demos.usage-animated-bfs') + + def test_usage_breadthfirst_layout(self): + self.create_usage_test('demos.usage-breadthfirst-layout') + + def test_usage_compound_nodes(self): + self.create_usage_test('demos.usage-compound-nodes') + + def test_usage_events(self): + self.create_usage_test('usage-events') + + def test_usage_elements(self): + self.create_usage_test('usage-elements') + + def test_usage_pie_style(self): + self.create_usage_test('demos.usage-pie-style') + + def test_usage_simple(self): + self.create_usage_test('usage') + + def test_usage_stylesheet(self): + self.create_usage_test('usage-stylesheet') + + def test_usage_initialisation(self): + self.create_usage_test('demos.usage-initialisation') + + def test_usage_linkout_example(self): + self.create_usage_test('demos.usage-linkout-example') From c0c79a2c05cc3c4c429c4a3e52f7c652b437f23b Mon Sep 17 00:00:00 2001 From: Xing Han Lu Date: Wed, 27 Feb 2019 23:28:29 -0500 Subject: [PATCH 07/16] Remove validate-init to run node tests --- dash_cytoscape/package.json | 1 - package.json | 1 - 2 files changed, 2 deletions(-) diff --git a/dash_cytoscape/package.json b/dash_cytoscape/package.json index 1ca08185..db759bd7 100644 --- a/dash_cytoscape/package.json +++ b/dash_cytoscape/package.json @@ -6,7 +6,6 @@ "scripts": { "start": "webpack-serve ./webpack.serve.config.js --open", "validate-init": "python _validate_init.py", - "prepublish": "npm run validate-init", "build:js-dev": "webpack --mode development", "build:js": "webpack --mode production", "build:py": "dash-generate-components ./src/lib/components dash_cytoscape", diff --git a/package.json b/package.json index 1ca08185..db759bd7 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,6 @@ "scripts": { "start": "webpack-serve ./webpack.serve.config.js --open", "validate-init": "python _validate_init.py", - "prepublish": "npm run validate-init", "build:js-dev": "webpack --mode development", "build:js": "webpack --mode production", "build:py": "dash-generate-components ./src/lib/components dash_cytoscape", From 569aadd266eed058c15d52be0188a3844e9c9a2b Mon Sep 17 00:00:00 2001 From: Xing Han Lu Date: Wed, 27 Feb 2019 23:29:50 -0500 Subject: [PATCH 08/16] Create test_percy_snapshot.py Create a single app that generate a webpage containing all the screenshots taken in the test_usage.py. We then take a screenshot of everything using percy, and this is used to compare differences. We employ this method because it is currently impossible for percy to render canvas elements (since it directly crawls the DOM), so this is the only way to proceed --- tests/test_percy_snapshot.py | 48 ++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 tests/test_percy_snapshot.py diff --git a/tests/test_percy_snapshot.py b/tests/test_percy_snapshot.py new file mode 100644 index 00000000..f2b19ff2 --- /dev/null +++ b/tests/test_percy_snapshot.py @@ -0,0 +1,48 @@ +import base64 +import dash +import dash_html_components as html +import os +from .IntegrationTests import IntegrationTests +from selenium.webdriver.common.by import By +from selenium.webdriver.support.ui import WebDriverWait +from selenium.webdriver.support import expected_conditions as EC + + +class Tests(IntegrationTests): + def test_usage(self): + def encode(name): + path = os.path.join( + os.path.dirname(__file__), + 'screenshots', + name + ) + + with open(path, 'rb') as image_file: + encoded_string = base64.b64encode(image_file.read()) + return "data:image/png;base64," + encoded_string.decode('ascii') + + def image_section(name): + return html.Div([ + html.P(name), + html.Img(src=encode(name)) + ]) + + asset_list = os.listdir(os.path.join( + os.path.dirname(__file__), + 'screenshots' + )) + + app = dash.Dash(__name__) + + app.layout = html.Div([ + image_section(name) + for name in asset_list if name.endswith('png') + ]) + + self.startServer(app) + + WebDriverWait(self.driver, 30).until( + EC.presence_of_element_located((By.CSS_SELECTOR, "img")) + ) + + self.percy_snapshot(name='Snapshot of all usage apps') From 98bab119a5549d6fab9f4320fa028601c4b16f0b Mon Sep 17 00:00:00 2001 From: Xing Han Lu Date: Thu, 28 Feb 2019 11:09:45 -0500 Subject: [PATCH 09/16] Update config.yml: Add python 3.7 tests, add supplementary tests --- .circleci/config.yml | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e7454f2a..72ef31f7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -26,12 +26,12 @@ jobs: when: always - "python-3.6": + "python-3.6": &test-template docker: - image: circleci/python:3.6-stretch-browsers environment: - PERCY_ENABLED: False + PERCY_ENABLED: True steps: - checkout @@ -70,16 +70,31 @@ jobs: when: always - run: - name: Integration Tests + name: Integration Tests - Usage command: | . venv/bin/activate - python -m unittest tests.test_render + python -m unittest tests.test_usage when: always + - run: + name: Capture Percy Snapshots + command: | + . venv/bin/activate + python -m unittest tests.test_percy_snapshot + when: always + + "python-3.7": + <<: *test-template + docker: + - image: circleci/python:3.7-stretch-browsers + environment: + PERCY_ENABLE: False + workflows: version: 2 build: jobs: - "python-3.6" + - "python-3.7" - "node" From 2c2a474ed0fde361f94f734724fc27f0cedf740a Mon Sep 17 00:00:00 2001 From: Xing Han Lu Date: Thu, 28 Feb 2019 15:52:28 -0500 Subject: [PATCH 10/16] Remove unused requirements --- tests/requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/requirements.txt b/tests/requirements.txt index 92c7a3e3..7e492fb4 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -13,5 +13,4 @@ selenium flake8 pylint pytest-dash>=1.0.1 -dash-cytoscape colour==0.1.5 \ No newline at end of file From 57d31df14f0106a9cce9fb7052d1a810545a6a91 Mon Sep 17 00:00:00 2001 From: Xing Han Lu Date: Thu, 28 Feb 2019 15:52:43 -0500 Subject: [PATCH 11/16] Clarify purpose of tests/screenshots --- tests/screenshots/readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/screenshots/readme.md b/tests/screenshots/readme.md index 3c56f45b..4ab55142 100644 --- a/tests/screenshots/readme.md +++ b/tests/screenshots/readme.md @@ -1,3 +1,3 @@ -Please do not add unecessary files to this directory. This is reserved for auto-generated screenshots from testing. +This is directory is reserved for screenshots generated by Selenium's webdriver in `test_usage.py`, during the CircleCI builds. -Please do not move this file. \ No newline at end of file +Please do not add unecessary files to this directory (in fact, the only file should be this `readme.md`), and do not move this file. \ No newline at end of file From c94b1ac12bdec1153c9153f68564984eaf812aa8 Mon Sep 17 00:00:00 2001 From: Xing Han Lu Date: Thu, 28 Feb 2019 15:52:52 -0500 Subject: [PATCH 12/16] Add explanation about test cases --- tests/test_percy_snapshot.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_percy_snapshot.py b/tests/test_percy_snapshot.py index f2b19ff2..f5487820 100644 --- a/tests/test_percy_snapshot.py +++ b/tests/test_percy_snapshot.py @@ -9,6 +9,16 @@ class Tests(IntegrationTests): + """ + In order to render snapshots, Percy collects the DOM of the project and + uses a custom rendering method, different from Selenium. Therefore, it + is unable to render Canvas elements, so can't render Cytoscape charts + directly. + + Instead, we use Selenium webdrivers to automatically screenshot each of + the apps being tested in test_usage.py, display them in a simple + Dash app, and use Percy to take a snapshot for CVI. + """ def test_usage(self): def encode(name): path = os.path.join( From 372912bf3a35fb55f00be59b6e60329eface05fc Mon Sep 17 00:00:00 2001 From: Xing Han Lu Date: Thu, 28 Feb 2019 18:03:03 -0500 Subject: [PATCH 13/16] Break down percy.io tests into multiple snapshots --- tests/IntegrationTests.py | 21 +++++++------ tests/test_percy_snapshot.py | 59 ++++++++++++++++++++++++------------ 2 files changed, 51 insertions(+), 29 deletions(-) diff --git a/tests/IntegrationTests.py b/tests/IntegrationTests.py index 15707cef..902a44f2 100644 --- a/tests/IntegrationTests.py +++ b/tests/IntegrationTests.py @@ -22,8 +22,7 @@ def percy_snapshot(self, name=''): snapshot_name = '{} - {}'.format(name, sys.version_info) self.percy_runner.snapshot( - name=snapshot_name, - enable_javascript=True + name=snapshot_name ) @classmethod @@ -39,7 +38,8 @@ def setUpClass(cls): if os.environ.get('PERCY_ENABLED', False): loader = percy.ResourceLoader(webdriver=cls.driver) - cls.percy_runner = percy.Runner(loader=loader) + percy_config = percy.Config(default_widths=[1280]) + cls.percy_runner = percy.Runner(loader=loader, config=percy_config) cls.percy_runner.initialize_build() @classmethod @@ -53,15 +53,16 @@ def tearDownClass(cls): def setUp(self): pass - def tearDown(self): + def tearDown(self, port=8050): time.sleep(3) if platform.system() == 'Windows': - requests.get('http://localhost:8050/stop') + requests.get('http://localhost:{}/stop'.format(port)) + sys.exit() else: self.server_process.terminate() time.sleep(3) - def startServer(self, app): + def startServer(self, app, port=8050): if 'DASH_TEST_PROCESSES' in os.environ: processes = int(os.environ['DASH_TEST_PROCESSES']) else: @@ -71,7 +72,7 @@ def run(): app.scripts.config.serve_locally = True app.css.config.serve_locally = True app.run_server( - port=8050, + port=port, debug=False, processes=processes ) @@ -87,9 +88,9 @@ def _stop_server_windows(): return 'stop' app.run_server( - port=8050, + port=port, debug=False, - threaded=True + threaded=False ) # Run on a separate process so that it doesn't block @@ -105,5 +106,5 @@ def _stop_server_windows(): time.sleep(5) # Visit the dash page - self.driver.get('http://localhost:8050') + self.driver.get('http://localhost:{}'.format(port)) time.sleep(0.5) diff --git a/tests/test_percy_snapshot.py b/tests/test_percy_snapshot.py index f5487820..c35fa5ec 100644 --- a/tests/test_percy_snapshot.py +++ b/tests/test_percy_snapshot.py @@ -1,8 +1,11 @@ import base64 -import dash -import dash_html_components as html import os +import time + from .IntegrationTests import IntegrationTests +import dash +import dash_html_components as html +import dash_core_components as dcc from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC @@ -31,28 +34,46 @@ def encode(name): encoded_string = base64.b64encode(image_file.read()) return "data:image/png;base64," + encoded_string.decode('ascii') - def image_section(name): - return html.Div([ - html.P(name), - html.Img(src=encode(name)) - ]) - - asset_list = os.listdir(os.path.join( - os.path.dirname(__file__), - 'screenshots' - )) - + # Define the app app = dash.Dash(__name__) app.layout = html.Div([ - image_section(name) - for name in asset_list if name.endswith('png') + # represents the URL bar, doesn't render anything + dcc.Location(id='url', refresh=False), + # content will be rendered in this element + html.Div(id='page-content') ]) + @app.callback(dash.dependencies.Output('page-content', 'children'), + [dash.dependencies.Input('url', 'pathname')]) + def display_image(pathname): + """ + Assign the url path to return the image it represent. For example, + to return "usage.png", you can visit localhost/usage.png. + :param pathname: name of the screenshot, prefixed with "/" + :return: An html.Img object containing the base64 encoded image + """ + if pathname: + name = pathname.replace('/', '') + return html.Img(id=name, src=encode(name)) + + # Start the app self.startServer(app) - WebDriverWait(self.driver, 30).until( - EC.presence_of_element_located((By.CSS_SELECTOR, "img")) - ) + # Find the names of all the screenshots + asset_list = os.listdir(os.path.join( + os.path.dirname(__file__), + 'screenshots' + )) + + # Run Percy + for image in asset_list: + if image.endswith('png'): + self.driver.get('http://localhost:8050/{}'.format(image)) + + WebDriverWait(self.driver, 20).until( + EC.presence_of_element_located((By.ID, image)) + ) - self.percy_snapshot(name='Snapshot of all usage apps') + self.percy_snapshot(name=image) + time.sleep(2) From 500c6476b6aa115f9c840dc2fad9b6e1bea7b5c7 Mon Sep 17 00:00:00 2001 From: Xing Han Lu Date: Thu, 28 Feb 2019 18:13:51 -0500 Subject: [PATCH 14/16] Pylint on tests --- tests/IntegrationTests.py | 4 ++-- tests/test_percy_snapshot.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/IntegrationTests.py b/tests/IntegrationTests.py index 902a44f2..e3237de8 100644 --- a/tests/IntegrationTests.py +++ b/tests/IntegrationTests.py @@ -53,10 +53,10 @@ def tearDownClass(cls): def setUp(self): pass - def tearDown(self, port=8050): + def tearDown(self): time.sleep(3) if platform.system() == 'Windows': - requests.get('http://localhost:{}/stop'.format(port)) + requests.get('http://localhost:8050/stop') sys.exit() else: self.server_process.terminate() diff --git a/tests/test_percy_snapshot.py b/tests/test_percy_snapshot.py index c35fa5ec..c887e06d 100644 --- a/tests/test_percy_snapshot.py +++ b/tests/test_percy_snapshot.py @@ -22,6 +22,7 @@ class Tests(IntegrationTests): the apps being tested in test_usage.py, display them in a simple Dash app, and use Percy to take a snapshot for CVI. """ + def test_usage(self): def encode(name): path = os.path.join( @@ -53,7 +54,9 @@ def display_image(pathname): :param pathname: name of the screenshot, prefixed with "/" :return: An html.Img object containing the base64 encoded image """ - if pathname: + if not pathname or pathname == '/': + return + else: name = pathname.replace('/', '') return html.Img(id=name, src=encode(name)) From 49440301798e4aa5d83aacd5ceaaf612c06da3da Mon Sep 17 00:00:00 2001 From: Xing Han Lu Date: Thu, 28 Feb 2019 18:19:02 -0500 Subject: [PATCH 15/16] Disable W0612 --- tests/test_percy_snapshot.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_percy_snapshot.py b/tests/test_percy_snapshot.py index c887e06d..b37717a0 100644 --- a/tests/test_percy_snapshot.py +++ b/tests/test_percy_snapshot.py @@ -47,7 +47,7 @@ def encode(name): @app.callback(dash.dependencies.Output('page-content', 'children'), [dash.dependencies.Input('url', 'pathname')]) - def display_image(pathname): + def display_image(pathname): # pylint: disable=W0612 """ Assign the url path to return the image it represent. For example, to return "usage.png", you can visit localhost/usage.png. @@ -56,9 +56,9 @@ def display_image(pathname): """ if not pathname or pathname == '/': return - else: - name = pathname.replace('/', '') - return html.Img(id=name, src=encode(name)) + + name = pathname.replace('/', '') + return html.Img(id=name, src=encode(name)) # Start the app self.startServer(app) From bfce62606a6b4186874e3aeed91570f67ee55d2a Mon Sep 17 00:00:00 2001 From: Xing Han Lu Date: Thu, 28 Feb 2019 18:23:37 -0500 Subject: [PATCH 16/16] Fix Pylint R1710 --- tests/test_percy_snapshot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_percy_snapshot.py b/tests/test_percy_snapshot.py index b37717a0..72a20268 100644 --- a/tests/test_percy_snapshot.py +++ b/tests/test_percy_snapshot.py @@ -55,7 +55,7 @@ def display_image(pathname): # pylint: disable=W0612 :return: An html.Img object containing the base64 encoded image """ if not pathname or pathname == '/': - return + return None name = pathname.replace('/', '') return html.Img(id=name, src=encode(name))