Browse Source

DLInfo: added docstring

Fabian Peter Hammerle 4 years ago
parent
commit
e95be5ccb3
2 changed files with 8 additions and 1 deletions
  1. 1 1
      .gitlab-ci.yml
  2. 7 0
      dlinfo/__init__.py

+ 1 - 1
.gitlab-ci.yml

@@ -24,7 +24,7 @@ linting:
 tests:
   stage: test
   script:
-  - pipenv run pytest --cov dlinfo --cov-report term-missing
+  - pipenv run pytest --doctest-modules --cov dlinfo --cov-report term-missing
 
 pack:
   stage: pack

+ 7 - 0
dlinfo/__init__.py

@@ -25,6 +25,13 @@ _DLINFO.restype = ctypes.c_int
 
 class DLInfo:
 
+    """
+    >>> lib = ctypes.cdll.LoadLibrary(ctypes.util.find_library('c'))
+    >>> dlinfo = DLInfo(lib)
+    >>> dlinfo.path
+    '/lib/x86_64-linux-gnu/libc.so.6'
+    """
+
     def __init__(self, cdll: ctypes.CDLL):
         _linkmap = ctypes.c_void_p()
         # pylint: disable=protected-access