-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add tests to reproduce import errors #86 * Add missing imports for #86 after adding tests to reproduce * Create temporary files so that the deployment tests need less mocking * Improve variable name to fix spelling * Add spelling expectation for tempfile
- Loading branch information
1 parent
65126bf
commit fc1c02b
Showing
5 changed files
with
55 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -607,6 +607,7 @@ tcpserver | |
td | ||
telem | ||
tempdir | ||
tempfile | ||
testcase | ||
TESTLIST | ||
textarea | ||
|
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
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,35 @@ | ||
import platform | ||
import tempfile | ||
import unittest | ||
from pathlib import Path | ||
|
||
from unittest import mock | ||
|
||
from fprime_gds.executables import run_deployment | ||
|
||
|
||
class TestRunDeployment(unittest.TestCase): | ||
|
||
def test_as_in_installation_instructions(self): | ||
# Same as the "Testing F´ GDS Installation Via Running HTML GUI" from | ||
# https://nasa.github.io/fprime/INSTALL.html | ||
# fprime-gds -g html -r <path to fprime checkout>/Ref/build-artifacts | ||
with tempfile.TemporaryDirectory() as temporary_directory: | ||
self.create_fake_deployment_structure(temporary_directory) | ||
with mock.patch("sys.argv", ["main", "-g", "html", "-r", temporary_directory]): | ||
run_deployment.get_settings() | ||
|
||
def create_fake_deployment_structure(self, temporary_directory): | ||
system_dir = Path(temporary_directory) / platform.system() | ||
|
||
bin_dir = system_dir / "bin" | ||
bin_dir.mkdir(parents=True) | ||
bin_file = bin_dir / "Test" | ||
with bin_file.open(mode="wb") as fake_app: | ||
fake_app.write("fake app".encode("utf-8")) | ||
|
||
dictionary_dir = system_dir / "dict" | ||
dictionary_dir.mkdir(parents=True) | ||
dictionary_file = dictionary_dir / "TestTopologyAppDictionary.xml" | ||
with dictionary_file.open(mode="w") as fake_dictionary: | ||
fake_dictionary.write("<test></test>") |
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,17 @@ | ||
import unittest | ||
from pathlib import Path | ||
|
||
from fprime_gds.executables import utils | ||
|
||
|
||
class TestFormatString(unittest.TestCase): | ||
|
||
def test_find_app_with_no_bin_dir_exits(self): | ||
path_with_no_bin = Path("") | ||
with self.assertRaises(SystemExit): | ||
utils.find_app(path_with_no_bin) | ||
|
||
def test_find_dict_with_no_dict_dir_exits(self): | ||
path_with_no_dict = Path("") | ||
with self.assertRaises(SystemExit): | ||
utils.find_app(path_with_no_dict) |