devpi-admin 1.0.0__tar.gz → 1.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: devpi-admin
3
- Version: 1.0.0
3
+ Version: 1.0.1
4
4
  Summary: Modern web UI plugin for devpi-server — drop-in replacement for devpi-web
5
5
  Author-email: Pavel Revak <pavelrevak@gmail.com>
6
6
  License: MIT
@@ -145,6 +145,15 @@ The static files live at `src/devpi_admin/static/` and can be edited in place
145
145
  show up on the next browser reload, no restart of devpi-server required (static views
146
146
  read from disk on each request).
147
147
 
148
+ Run the unit tests:
149
+
150
+ ```bash
151
+ PYTHONWARNINGS="ignore::UserWarning" python -m unittest discover -v tests/
152
+ ```
153
+
154
+ (The `PYTHONWARNINGS` shim hides an unrelated deprecation warning emitted by Pyramid 2.1
155
+ when it imports `pkg_resources`.)
156
+
148
157
  ## Author
149
158
 
150
159
  Pavel Revak <pavelrevak@gmail.com>
@@ -124,6 +124,15 @@ The static files live at `src/devpi_admin/static/` and can be edited in place
124
124
  show up on the next browser reload, no restart of devpi-server required (static views
125
125
  read from disk on each request).
126
126
 
127
+ Run the unit tests:
128
+
129
+ ```bash
130
+ PYTHONWARNINGS="ignore::UserWarning" python -m unittest discover -v tests/
131
+ ```
132
+
133
+ (The `PYTHONWARNINGS` shim hides an unrelated deprecation warning emitted by Pyramid 2.1
134
+ when it imports `pkg_resources`.)
135
+
127
136
  ## Author
128
137
 
129
138
  Pavel Revak <pavelrevak@gmail.com>
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '1.0.0'
22
- __version_tuple__ = version_tuple = (1, 0, 0)
21
+ __version__ = version = '1.0.1'
22
+ __version_tuple__ = version_tuple = (1, 0, 1)
23
23
 
24
24
  __commit_id__ = commit_id = None
@@ -7,6 +7,7 @@ the standard devpi JSON API (``/+login``, ``/<user>/<index>``, ...).
7
7
  """
8
8
  from pathlib import Path
9
9
 
10
+ from devpi_server.config import hookimpl
10
11
  from pyramid.httpexceptions import HTTPFound
11
12
  from pyramid.response import FileResponse
12
13
 
@@ -14,11 +15,12 @@ from pyramid.response import FileResponse
14
15
  STATIC_DIR = Path(__file__).parent / "static"
15
16
 
16
17
 
18
+ @hookimpl
17
19
  def devpiserver_get_features():
18
- # Advertise the plugin to devpi-server
19
20
  return {"devpi-admin"}
20
21
 
21
22
 
23
+ @hookimpl
22
24
  def devpiserver_pyramid_configure(config, pyramid_config):
23
25
  # Serve bundled static assets (index.html, css/, js/) under /+admin/.
24
26
  pyramid_config.add_static_view(
File without changes
@@ -0,0 +1,55 @@
1
+ """Tests that plugin hooks are properly registered with pluggy."""
2
+ import unittest
3
+
4
+ from pluggy import PluginManager
5
+
6
+ from devpi_server import hookspecs
7
+ import devpi_admin.main as plugin
8
+
9
+
10
+ class HookRegistrationTests(unittest.TestCase):
11
+
12
+ def setUp(self):
13
+ self.pm = PluginManager("devpiserver")
14
+ self.pm.add_hookspecs(hookspecs)
15
+ self.pm.register(plugin)
16
+
17
+ def test_plugin_registered(self):
18
+ self.assertTrue(
19
+ self.pm.is_registered(plugin),
20
+ "plugin module not registered with pluggy")
21
+
22
+ def test_get_features_recognized(self):
23
+ results = self.pm.hook.devpiserver_get_features()
24
+ found = set()
25
+ for s in results:
26
+ found.update(s)
27
+ self.assertIn("devpi-admin", found)
28
+
29
+ def test_pyramid_configure_recognized(self):
30
+ callers = self.pm.hook.devpiserver_pyramid_configure.\
31
+ get_hookimpls()
32
+ modules = [impl.plugin for impl in callers]
33
+ self.assertIn(plugin, modules,
34
+ "devpiserver_pyramid_configure not found in hook impls")
35
+
36
+ def test_no_unknown_hooks(self):
37
+ # All public devpiserver_* functions must be valid hookspecs.
38
+ # If a function has @hookimpl but a typo in the name, pluggy
39
+ # would reject it at register() — this test catches that.
40
+ hook_names = [
41
+ name for name in dir(plugin)
42
+ if name.startswith("devpiserver_") and callable(getattr(plugin, name))
43
+ ]
44
+ spec_names = [
45
+ name for name in dir(hookspecs)
46
+ if name.startswith("devpiserver_") and callable(getattr(hookspecs, name))
47
+ ]
48
+ for name in hook_names:
49
+ self.assertIn(
50
+ name, spec_names,
51
+ "{} is not a valid devpi-server hookspec".format(name))
52
+
53
+
54
+ if __name__ == "__main__":
55
+ unittest.main()
@@ -1,8 +0,0 @@
1
- import warnings
2
-
3
- # Pyramid 2.1 imports pkg_resources at module load time and triggers a
4
- # setuptools deprecation warning. Silence it so test output stays clean.
5
- warnings.filterwarnings(
6
- "ignore", category=UserWarning, module="pyramid.path")
7
- warnings.filterwarnings(
8
- "ignore", category=DeprecationWarning, module="pkg_resources")
File without changes
File without changes
File without changes