This repository has been archived by the owner on Jun 3, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add check that dash was correctly imported and exit with helpful mess…
…age if failed (#177) * add check that dash was imported and exit with useful message if not * added test to check sys.exit(1) called when dash not import correctly * fix wrong module name
- Loading branch information
Showing
3 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import os | ||
import unittest | ||
|
||
|
||
class TestDashImport(unittest.TestCase): | ||
def setUp(self): | ||
with open('dash.py', 'w') as f: | ||
pass | ||
|
||
def tearDown(self): | ||
try: | ||
os.remove('dash.py') | ||
os.remove('dash.pyc') | ||
except OSError: | ||
pass | ||
|
||
def test_dash_import(self): | ||
"""Test that program exits if the wrong dash module was imported""" | ||
|
||
with self.assertRaises(SystemExit) as cm: | ||
import dash_core_components | ||
|
||
self.assertEqual(cm.exception.code, 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters