Move configuration into __init__.py
authorKarl O. Pinc <kop@meme.com>
Thu, 25 Oct 2018 21:06:56 +0000 (16:06 -0500)
committerKarl O. Pinc <kop@meme.com>
Fri, 26 Oct 2018 00:48:34 +0000 (19:48 -0500)
src/pgwui_common/__init__.py
src/pgwui_common/configure.py [deleted file]
tests/test___init__.py [new file with mode: 0644]
tests/test_configure.py [deleted file]

index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..504dad1acf9f1b9e54fbada836256f2636affb46 100644 (file)
@@ -0,0 +1,44 @@
+# Copyright (C) 2018 The Meme Factory, Inc.  http://www.meme.com/
+
+# This file is part of PGWUI_Common.
+#
+# This program is free software: you can redistribute it and/or
+# modify it under the terms of the GNU Affero General Public License
+# as published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public
+# License along with this program.  If not, see
+# <http://www.gnu.org/licenses/>.
+#
+
+# Karl O. Pinc <kop@meme.com>
+
+'''Provide a way to configure PGWUI.
+
+To use pgwui_common configure your pyramid app by putting the
+following into your package's __init__.py:
+
+    from pyramid.config import Configurator
+
+    def main(global_config, **settings):
+        config = Configurator()
+        config.include('pgwui_common')
+
+Note that you can override any of the assets in this package or any of
+the PGWUI packages, any of the templates or css, using Pyramid's Asset
+Override API (or via pyramid.includes = yourextension in the .ini file).
+
+'''
+
+
+def includeme(config):
+    config.include('pyramid_mako')
+    config.include('pyramid_beaker')
+    config.add_static_view(
+        'static', 'pgwui_common:/static', cache_max_age=3600)
diff --git a/src/pgwui_common/configure.py b/src/pgwui_common/configure.py
deleted file mode 100644 (file)
index d8103a8..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright (C) 2018 The Meme Factory, Inc.  http://www.meme.com/
-
-# This file is part of PGWUI_Common.
-#
-# This program is free software: you can redistribute it and/or
-# modify it under the terms of the GNU Affero General Public License
-# as published by the Free Software Foundation, either version 3 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public
-# License along with this program.  If not, see
-# <http://www.gnu.org/licenses/>.
-#
-
-# Karl O. Pinc <kop@meme.com>
-
-'''Provide a way to configure PGWUI.
-
-To use pgwui_common configure your pyramid app by putting the
-following into your package's __init__.py:
-
-    from pyramid.config import Configurator
-
-    def main(global_config, **settings):
-        config = Configurator()
-        config.include('pgwui_common.configure.includeme')
-
-Note that you can override any of the assets in this package or any of
-the PGWUI packages, any of the templates or css, using Pyramid's Asset
-Override API (or via pyramid.includes = yourextension in the .ini file).
-
-'''
-
-
-def includeme(config):
-    config.include('pyramid_mako')
-    config.include('pyramid_beaker')
-    config.add_static_view(
-        'static', 'pgwui_common:/static', cache_max_age=3600)
diff --git a/tests/test___init__.py b/tests/test___init__.py
new file mode 100644 (file)
index 0000000..917efd6
--- /dev/null
@@ -0,0 +1,41 @@
+# Copyright (C) 2018 The Meme Factory, Inc.  http://www.meme.com/
+
+# This file is part of PGWUI_Common.
+#
+# This program is free software: you can redistribute it and/or
+# modify it under the terms of the GNU Affero General Public License
+# as published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public
+# License along with this program.  If not, see
+# <http://www.gnu.org/licenses/>.
+#
+
+# Karl O. Pinc <kop@meme.com>
+
+import pgwui_common.__init__ as pgwui_common_init
+
+
+def test_configure_includecalled():
+
+    class MockConfig():
+        def __init__(self):
+            self.include_called = False
+            self.add_static_view_called = False
+
+        def include(self, *args):
+            self.include_called = True
+
+        def add_static_view(self, *args, **kwargs):
+            self.add_static_view_called = True
+
+    config = MockConfig()
+    pgwui_common_init.includeme(config)
+    assert config.include_called
+    assert config.add_static_view_called
diff --git a/tests/test_configure.py b/tests/test_configure.py
deleted file mode 100644 (file)
index ca4eaa6..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright (C) 2018 The Meme Factory, Inc.  http://www.meme.com/
-
-# This file is part of PGWUI_Common.
-#
-# This program is free software: you can redistribute it and/or
-# modify it under the terms of the GNU Affero General Public License
-# as published by the Free Software Foundation, either version 3 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public
-# License along with this program.  If not, see
-# <http://www.gnu.org/licenses/>.
-#
-
-# Karl O. Pinc <kop@meme.com>
-
-from pgwui_common import configure
-
-
-def test_configure_includecalled():
-
-    class MockConfig():
-        def __init__(self):
-            self.include_called = False
-            self.add_static_view_called = False
-
-        def include(self, *args):
-            self.include_called = True
-
-        def add_static_view(self, *args, **kwargs):
-            self.add_static_view_called = True
-
-    config = MockConfig()
-    configure.includeme(config)
-    assert config.include_called
-    assert config.add_static_view_called