From 6c45c47e4bedfcfeadf5c29d5c3ecc4c2cf7aa7c Mon Sep 17 00:00:00 2001 From: Akihiro Motoki Date: Wed, 22 Nov 2017 14:45:04 +0000 Subject: [PATCH] Drop unnecessary executable flags This patch also adds checks for executable files in pep8 job. nose ignores executable files by default, so it is important to ensure executable flag is not set for test files [1]. openstack_dashboard/test/test_plugins/panel_tests.py was not tested actually and it was broken. This commit fixes it too. [1] http://nose.readthedocs.io/en/latest/usage.html#cmdoption-exe Co-Authored-By: Ivan Kolodyazhny Change-Id: I3a124fa2f9f0676b2b43a094e32e3d8b18fa6005 --- doc/source/contributor/tutorials/plugin.rst | 0 .../static/horizon/js/horizon.extensible_header.js | 0 .../static/app/core/trunks/details/details.module.js | 0 .../app/core/trunks/details/overview.controller.js | 0 .../static/app/core/trunks/details/overview.html | 0 .../static/dashboard/scss/components/_navbar.scss | 0 openstack_dashboard/templates/header/_header.html | 0 .../templates/header/_header_sections.html | 0 openstack_dashboard/templates/horizon/_scripts.html | 0 openstack_dashboard/test/extensible_header_urls.py | 0 .../plugin_panel/templates/plugin_panel/header.html | 0 .../test/test_panels/plugin_panel/views.py | 0 .../test_plugins/panel_config/_10_admin_add_panel.py | 0 openstack_dashboard/test/test_plugins/panel_tests.py | 5 +++-- .../themes/material/templates/header/_header.html | 0 openstack_dashboard/urls.py | 0 openstack_dashboard/utils/settings.py | 0 openstack_dashboard/views.py | 0 tools/executable_files.txt | 5 +++++ tools/find_executables.sh | 11 +++++++++++ tox.ini | 3 ++- 21 files changed, 21 insertions(+), 3 deletions(-) mode change 100755 => 100644 doc/source/contributor/tutorials/plugin.rst mode change 100755 => 100644 horizon/static/horizon/js/horizon.extensible_header.js mode change 100755 => 100644 openstack_dashboard/static/app/core/trunks/details/details.module.js mode change 100755 => 100644 openstack_dashboard/static/app/core/trunks/details/overview.controller.js mode change 100755 => 100644 openstack_dashboard/static/app/core/trunks/details/overview.html mode change 100755 => 100644 openstack_dashboard/static/dashboard/scss/components/_navbar.scss mode change 100755 => 100644 openstack_dashboard/templates/header/_header.html mode change 100755 => 100644 openstack_dashboard/templates/header/_header_sections.html mode change 100755 => 100644 openstack_dashboard/templates/horizon/_scripts.html mode change 100755 => 100644 openstack_dashboard/test/extensible_header_urls.py mode change 100755 => 100644 openstack_dashboard/test/test_panels/plugin_panel/templates/plugin_panel/header.html mode change 100755 => 100644 openstack_dashboard/test/test_panels/plugin_panel/views.py mode change 100755 => 100644 openstack_dashboard/test/test_plugins/panel_config/_10_admin_add_panel.py mode change 100755 => 100644 openstack_dashboard/test/test_plugins/panel_tests.py mode change 100755 => 100644 openstack_dashboard/themes/material/templates/header/_header.html mode change 100755 => 100644 openstack_dashboard/urls.py mode change 100755 => 100644 openstack_dashboard/utils/settings.py mode change 100755 => 100644 openstack_dashboard/views.py create mode 100644 tools/executable_files.txt create mode 100644 tools/find_executables.sh diff --git a/doc/source/contributor/tutorials/plugin.rst b/doc/source/contributor/tutorials/plugin.rst old mode 100755 new mode 100644 diff --git a/horizon/static/horizon/js/horizon.extensible_header.js b/horizon/static/horizon/js/horizon.extensible_header.js old mode 100755 new mode 100644 diff --git a/openstack_dashboard/static/app/core/trunks/details/details.module.js b/openstack_dashboard/static/app/core/trunks/details/details.module.js old mode 100755 new mode 100644 diff --git a/openstack_dashboard/static/app/core/trunks/details/overview.controller.js b/openstack_dashboard/static/app/core/trunks/details/overview.controller.js old mode 100755 new mode 100644 diff --git a/openstack_dashboard/static/app/core/trunks/details/overview.html b/openstack_dashboard/static/app/core/trunks/details/overview.html old mode 100755 new mode 100644 diff --git a/openstack_dashboard/static/dashboard/scss/components/_navbar.scss b/openstack_dashboard/static/dashboard/scss/components/_navbar.scss old mode 100755 new mode 100644 diff --git a/openstack_dashboard/templates/header/_header.html b/openstack_dashboard/templates/header/_header.html old mode 100755 new mode 100644 diff --git a/openstack_dashboard/templates/header/_header_sections.html b/openstack_dashboard/templates/header/_header_sections.html old mode 100755 new mode 100644 diff --git a/openstack_dashboard/templates/horizon/_scripts.html b/openstack_dashboard/templates/horizon/_scripts.html old mode 100755 new mode 100644 diff --git a/openstack_dashboard/test/extensible_header_urls.py b/openstack_dashboard/test/extensible_header_urls.py old mode 100755 new mode 100644 diff --git a/openstack_dashboard/test/test_panels/plugin_panel/templates/plugin_panel/header.html b/openstack_dashboard/test/test_panels/plugin_panel/templates/plugin_panel/header.html old mode 100755 new mode 100644 diff --git a/openstack_dashboard/test/test_panels/plugin_panel/views.py b/openstack_dashboard/test/test_panels/plugin_panel/views.py old mode 100755 new mode 100644 diff --git a/openstack_dashboard/test/test_plugins/panel_config/_10_admin_add_panel.py b/openstack_dashboard/test/test_plugins/panel_config/_10_admin_add_panel.py old mode 100755 new mode 100644 diff --git a/openstack_dashboard/test/test_plugins/panel_tests.py b/openstack_dashboard/test/test_plugins/panel_tests.py old mode 100755 new mode 100644 index 34f06f98c7..7b98d00f56 --- a/openstack_dashboard/test/test_plugins/panel_tests.py +++ b/openstack_dashboard/test/test_plugins/panel_tests.py @@ -64,8 +64,9 @@ class PanelPluginTests(test.PluginTestCase): HORIZON_CONFIG['header_sections']) def test_extensible_header(self): - response = self.client.get('/header/') - self.assertIn('sample context', response.content) + with self.settings(ROOT_URLCONF=self.urls): + response = self.client.get('/header/') + self.assertIn('sample context', response.content.decode('utf-8')) def test_remove_panel(self): dashboard = horizon.get_dashboard("admin") diff --git a/openstack_dashboard/themes/material/templates/header/_header.html b/openstack_dashboard/themes/material/templates/header/_header.html old mode 100755 new mode 100644 diff --git a/openstack_dashboard/urls.py b/openstack_dashboard/urls.py old mode 100755 new mode 100644 diff --git a/openstack_dashboard/utils/settings.py b/openstack_dashboard/utils/settings.py old mode 100755 new mode 100644 diff --git a/openstack_dashboard/views.py b/openstack_dashboard/views.py old mode 100755 new mode 100644 diff --git a/tools/executable_files.txt b/tools/executable_files.txt new file mode 100644 index 0000000000..82aff2d420 --- /dev/null +++ b/tools/executable_files.txt @@ -0,0 +1,5 @@ +./manage.py +./tools/abandon_old_reviews.sh +./tools/gate/integration/post_test_hook.sh +./tools/gate/integration/pre_test_hook.sh +./tools/unit_tests.sh diff --git a/tools/find_executables.sh b/tools/find_executables.sh new file mode 100644 index 0000000000..4ac4fc9d33 --- /dev/null +++ b/tools/find_executables.sh @@ -0,0 +1,11 @@ +OUTPUT=`find . \( -name .tox -o -name .git \) -prune -o -type f -perm /a=x -print \ + | grep -v -F -f ./tools/executable_files.txt` +if [ -n "$OUTPUT" ]; then + echo "Unexpected executable files are found:" + for f in $OUTPUT; do + echo $f + done + echo + echo "If you really need to add an executable file, add it to tools/executable_files.txt" + exit 1 +fi diff --git a/tox.ini b/tox.ini index 60f64d67d1..d781951786 100644 --- a/tox.ini +++ b/tox.ini @@ -66,8 +66,9 @@ commands = [testenv:pep8] commands = - {envpython} {toxinidir}/manage.py extract_messages --verbosity 0 --check-only flake8 {posargs} + {envpython} {toxinidir}/manage.py extract_messages --verbosity 0 --check-only + bash {toxinidir}/tools/find_executables.sh [testenv:cover] commands =