Skip to content

Commit

Permalink
Keep ctrl-c working with enaml-run (#328)
Browse files Browse the repository at this point in the history
* Keep ctrl-c working with enaml-run
* Update release notes
* Add test for enaml-run
  • Loading branch information
frmdstryr authored and MatthieuDartiailh committed Nov 1, 2018
1 parent 2a6caab commit ac85d1f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
4 changes: 4 additions & 0 deletions enaml/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import optparse
import os
import signal
import sys
import types

Expand Down Expand Up @@ -59,6 +60,9 @@ def main():
with imports():
exec_(code, ns)

# Make sure ^C keeps working
signal.signal(signal.SIGINT, signal.SIG_DFL)

requested = options.component
if requested in ns:
from enaml.qt.qt_application import QtApplication
Expand Down
2 changes: 2 additions & 0 deletions releasenotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Enaml Release Notes

0.10.3 - unreleased
-------------------
- make enaml-run exit immediately when pressing ^c #328
- add enaml-compileall for generating .pyc and .enamlc files #262
- fix the tp_name value of all C extensions #318
- add pickle support for enaml's Color - #316
- add support for tiling and cascading to MdiArea PR # 259
Expand Down
24 changes: 24 additions & 0 deletions tests/test_runner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import sys
import pytest
from utils import enaml_run

from enaml.application import Application, deferred_call
from enaml.runner import main


@pytest.fixture
def sys_argv():
""" Fixture that saves sys.argv and restores it after the test completes
"""
argv = sys.argv
try:
yield
finally:
sys.argv = argv


def test_runner(enaml_run, sys_argv):
sys.argv = ['enaml-run', 'examples/stdlib/mapped_view.enaml']
main()

0 comments on commit ac85d1f

Please sign in to comment.