From 99cfab33b2e26116496c70047d58164adcf859bc Mon Sep 17 00:00:00 2001 From: dh00601 <dh00601@surrey.ac.uk> Date: Sat, 8 Jan 2022 22:13:26 +0000 Subject: [PATCH] small changes to tests --- badges/test_coverage.svg | 4 +-- .../test_version_info.py | 26 +++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/badges/test_coverage.svg b/badges/test_coverage.svg index 2fad913a4..179c6a178 100644 --- a/badges/test_coverage.svg +++ b/badges/test_coverage.svg @@ -15,7 +15,7 @@ <g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11"> <text x="31.5" y="15" fill="#010101" fill-opacity=".3">coverage</text> <text x="31.5" y="14">coverage</text> - <text x="80" y="15" fill="#010101" fill-opacity=".3">62%</text> - <text x="80" y="14">62%</text> + <text x="80" y="15" fill="#010101" fill-opacity=".3">63%</text> + <text x="80" y="14">63%</text> </g> </svg> diff --git a/binarycpython/tests/tests_population_extensions/test_version_info.py b/binarycpython/tests/tests_population_extensions/test_version_info.py index 7599dc650..195fdfceb 100644 --- a/binarycpython/tests/tests_population_extensions/test_version_info.py +++ b/binarycpython/tests/tests_population_extensions/test_version_info.py @@ -4,6 +4,7 @@ Unit tests for the _version_info Population extension module TODO: minimum_stellar_mass """ +import os import unittest from binarycpython.utils.functions import ( @@ -98,6 +99,31 @@ class test_return_binary_c_version_info(unittest.TestCase): self.assertIn("nucleosynthesis_sources", version_info_parsed.keys()) self.assertIn("miscellaneous", version_info_parsed.keys()) + def test_envvar(self): + with Capturing() as output: + self._test_envvar() + + def _test_envvar(self): + """ + Test for the parsed version info with a value already present + """ + + os.environ["BINARY_C_MACRO_HEADER"] = 'macroxyz' + + # also tests the parse_version_info indirectly + version_info_parsed = self._version_info_pop.return_binary_c_version_info(parsed=True) + + self.assertTrue(isinstance(version_info_parsed, dict)) + self.assertIn("isotopes", version_info_parsed.keys()) + self.assertIn("argpairs", version_info_parsed.keys()) + self.assertIn("ensembles", version_info_parsed.keys()) + self.assertIn("macros", version_info_parsed.keys()) + self.assertIn("elements", version_info_parsed.keys()) + self.assertIn("dt_limits", version_info_parsed.keys()) + self.assertIn("nucleosynthesis_sources", version_info_parsed.keys()) + self.assertIn("miscellaneous", version_info_parsed.keys()) + + class test_parse_binary_c_version_info(unittest.TestCase): """ Unittests for function parse_binary_c_version_info -- GitLab