Handle requirements for scripts (#2765)
This commit is contained in:
1 parent
a03691455b
commit
aadf6a7750
5 files changed
+56
-12
No files matched your search
@@ -0,0 +1 @@
|
||||
"""Tests for the scripts."""
|
||||
@@ -0,0 +1,19 @@
|
||||
"""Test script init."""
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
import homeassistant.scripts as scripts
|
||||
|
||||
|
||||
class TestScripts(unittest.TestCase):
|
||||
"""Tests homeassistant.scripts module."""
|
||||
|
||||
@patch('homeassistant.scripts.get_default_config_dir',
|
||||
return_value='/default')
|
||||
def test_config_per_platform(self, mock_def):
|
||||
"""Test config per platform method."""
|
||||
self.assertEquals(scripts.get_default_config_dir(), '/default')
|
||||
self.assertEqual(scripts.extract_config_dir(), '/default')
|
||||
self.assertEqual(scripts.extract_config_dir(['']), '/default')
|
||||
self.assertEqual(scripts.extract_config_dir(['-c', '/arg']), '/arg')
|
||||
self.assertEqual(scripts.extract_config_dir(['--config', '/a']), '/a')
|
||||
@@ -3,7 +3,7 @@ import os
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
import homeassistant.bootstrap as bootstrap
|
||||
from homeassistant.bootstrap import mount_local_lib_path
|
||||
import homeassistant.util.package as package
|
||||
|
||||
RESOURCE_DIR = os.path.abspath(
|
||||
@@ -21,7 +21,7 @@ class TestPackageUtil(unittest.TestCase):
|
||||
def setUp(self):
|
||||
"""Create local library for testing."""
|
||||
self.tmp_dir = tempfile.TemporaryDirectory()
|
||||
self.lib_dir = os.path.join(self.tmp_dir.name, 'deps')
|
||||
self.lib_dir = mount_local_lib_path(self.tmp_dir.name)
|
||||
|
||||
def tearDown(self):
|
||||
"""Stop everything that was started."""
|
||||
@@ -49,8 +49,6 @@ class TestPackageUtil(unittest.TestCase):
|
||||
self.assertTrue(package.check_package_exists(
|
||||
TEST_NEW_REQ, self.lib_dir))
|
||||
|
||||
bootstrap._mount_local_lib_path(self.tmp_dir.name)
|
||||
|
||||
try:
|
||||
import pyhelloworld3
|
||||
except ImportError:
|
||||
|
||||
Reference in new issue
Block a user