Hello, I'm trying to write unit tests for a dag an...
# ask-community
s
Hello, I'm trying to write unit tests for a dag and I'm running into an issue with exception throwing. I have an IO manager that can throw an exception and I'm testing that it will, unfortunately while the tests pass it yields an error from
generate_teardown_events
. Is this something I need to be concerned about, and if not how can I silence these messages they are polluting my test output.
j
hey @Sean Moss could you share the stack trace?
s
Copy code
Traceback (most recent call last):
  File "/Users/seanmoss/Library/Caches/pypoetry/virtualenvs/my-dagster-project-o6E1K-_S-py3.9/lib/python3.9/site-packages/dagster/_core/execution/build_resources.py", line 114, in build_resources
    list(resources_manager.generate_teardown_events())
  File "/Users/seanmoss/Library/Caches/pypoetry/virtualenvs/my-dagster-project-o6E1K-_S-py3.9/lib/python3.9/site-packages/dagster/_utils/__init__.py", line 557, in generate_teardown_events
    yield from self.generator
  File "/Users/seanmoss/Library/Caches/pypoetry/virtualenvs/my-dagster-project-o6E1K-_S-py3.9/lib/python3.9/site-packages/dagster/_core/execution/resources_init.py", line 282, in resource_initialization_event_generator
    yield from manager.generate_teardown_events()
  File "/Users/seanmoss/Library/Caches/pypoetry/virtualenvs/my-dagster-project-o6E1K-_S-py3.9/lib/python3.9/site-packages/dagster/_utils/__init__.py", line 557, in generate_teardown_events
    yield from self.generator
  File "/Users/seanmoss/Library/Caches/pypoetry/virtualenvs/my-dagster-project-o6E1K-_S-py3.9/lib/python3.9/site-packages/dagster/_core/execution/resources_init.py", line 360, in single_resource_event_generator
    check.failed(
  File "/Users/seanmoss/.pyenv/versions/3.9.6/lib/python3.9/contextlib.py", line 124, in __exit__
    next(self.gen)
  File "/Users/seanmoss/Library/Caches/pypoetry/virtualenvs/my-dagster-project-o6E1K-_S-py3.9/lib/python3.9/site-packages/dagster/_core/errors.py", line 218, in user_code_error_boundary
    log_manager.end_python_log_capture()
  File "/Users/seanmoss/.pyenv/versions/3.9.6/lib/python3.9/contextlib.py", line 124, in __exit__
    next(self.gen)
  File "/Users/seanmoss/Library/Caches/pypoetry/virtualenvs/my-dagster-project-o6E1K-_S-py3.9/lib/python3.9/site-packages/dagster/_core/errors.py", line 169, in raise_execution_interrupts
    yield
  File "/Users/seanmoss/.pyenv/versions/3.9.6/lib/python3.9/contextlib.py", line 124, in __exit__
    next(self.gen)
  File "/Users/seanmoss/Library/Caches/pypoetry/virtualenvs/my-dagster-project-o6E1K-_S-py3.9/lib/python3.9/site-packages/dagster/_utils/interrupts.py", line 98, in raise_interrupts_as
    _replace_interrupt_signal(original_signal_handler)
  File "/Users/seanmoss/Library/Caches/pypoetry/virtualenvs/my-dagster-project-o6E1K-_S-py3.9/lib/python3.9/site-packages/dagster/_utils/interrupts.py", line 27, in _replace_interrupt_signal
    signal.signal(signal.SIGINT, new_signal_handler)
  File "/Users/seanmoss/.pyenv/versions/3.9.6/lib/python3.9/signal.py", line 47, in signal
    handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
TypeError: signal handler must be signal.SIG_IGN, signal.SIG_DFL, or a callable object
j
hmm ok - and what exception are you raising within the io manager?
s
Currently a base
Exception
j
ok. this isn’t something ive ever seen before with raising exceptions in io managers. i’m going to reach out to some other folks on the team
s
This is part of a
pytest
just to clarify
j
spoke with a coworker and they dont think you have anything to worry about. there might be an issue on our end and we can look into it
s
Is there a solution to not generate that output currently?