question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: RuntimeWarning: Parent module 'hooks' not found while handling absolute import

See original GitHub issue

I’m facing this output while running dredd with python hooks enabled:

info: Configuration dredd.yml found, ignoring other arguments.
info: Using apiary reporter.
info: Beginning Dredd testing...
info: Found Hookfiles: ./hooks.py
info: Spawning `python` hooks handler
info: Hook handler stderr: ./hooks.py:1: RuntimeWarning: Parent module 'hooks' not found while handling absolute import
  import dredd_hooks as hooks

info: Hook handler stdout: Starting Dredd Python hooks handler

info: Connected to the hook handler, waiting 0.1s to start testing.
info: Dry run, skipping API Tests...
info: Dry run, skipping API Tests...
info: Dry run, skipping API Tests...
info: Dry run, skipping API Tests...
info: Dry run, skipping API Tests...
info: Dry run, skipping API Tests...
info: Sending SIGTERM to the hooks handler
info: Hook handler stderr:
Connection closed

My config is:

reporter: apiary
custom:
  apiaryApiKey: f941658c6714ebf58eeda5e0786e937f
  apiaryApiName: xos
dry-run: null
hookfiles: "./hooks.py"
language: python
sandbox: false
server: null
server-wait: 3
init: false
names: false
only: []
output: []
header: []
sorted: false
user: null
inline-errors: false
details: false
method: []
color: true
level: info
timestamp: false
silent: false
path: []
hooks-worker-timeout: 5000
hooks-worker-connect-timeout: 1500
hooks-worker-connect-retry: 500
hooks-worker-after-connect-wait: 100
hooks-worker-term-timeout: 5000
hooks-worker-term-retry: 500
hooks-worker-handler-host: localhost
hooks-worker-handler-port: 61321
blueprint: apiary.apib
endpoint: 'http://localhost:3000'

My hooks.py file is:

import dredd_hooks as hooks

@hooks.before_each
def my_before_each_hook(transaction):
    print('before each')

How can I solve this?

Thanks

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
honzajavorekcommented, Mar 30, 2016

@teone I’m glad we worked it out! However, I’ll leave this open to have a reminder this needs to go to docs. I added respective labels.

0reactions
honzajavorekcommented, Nov 3, 2016

This won’t go to docs! 😱 Why? Because it’s no more an issue thanks to https://github.com/apiaryio/dredd-hooks-python/pull/20! 🎉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Parent module 'plugins' not found while handling absolute ...
This function does not handle hierarchical module names (names containing dots). In order to find P.M, that is, submodule M of package P,...
Read more >
Parent module 'YOUR_MODULE_HERE' not found while ...
RuntimeWarning : Parent module 'YOUR_MODULE_HERE' not found while handling absolute import. When running tests from any submodule within test , my PyCharm ...
Read more >
RuntimeWarning: Parent module 'plugins' not found while ...
Python – Dynamic class loading in Python 2.6: RuntimeWarning: Parent module 'plugins' not found while handling absolute import.
Read more >
Absolute vs Relative Imports in Python
If you've worked on a Python project that has more than one file, chances are you've had to use an import statement before....
Read more >
6. Modules — Python 3.11.1 documentation
Now enter the Python interpreter and import this module with the following command: ... If not found, it then searches for a file...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found