def test_append_cli_parent_path(self): with patch('syspath.syspath._caller_path') as mock_caller_path: mock_caller_path.side_effect = RuntimeError() appended_path = syspath.append_parent_path() self.assertEqual(appended_path, sys.path[-1]) path = os.getcwd() parent = os.path.abspath(os.path.join(path, os.pardir)) self.assertEqual(appended_path, parent)
but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. ********************************************************************************************* """ print(copyright_string) __author__ = "Rafael Arndt, Olivier Huber, Caroline Löbhard, Steven-Marian Stengl" __copyright__ = "Copyright 2019, WIAS" __license__ = "GPL" __maintainer__ = "Caroline Löbhard" __email__ = "*****@*****.**" import syspath syspath.append_parent_path() import wiasct config_sty_content = [ "%this file is generated by build_config_sty.py and should not be edited by hand%" ] for name, color_object in wiasct.color_dict.items(): config_sty_content.append(color_object.tex_definition()) with open('generated_config.sty', 'w') as f: f.write("\n".join(config_sty_content))
from syspath import append_parent_path path = append_parent_path(index=4) if __name__ == "__main__": print(path)
def test_append_parent_path(self): appended_path = syspath.append_parent_path() self.assertEqual(len(sys.path), len(self.orig_sys_path) + 1) self.assertEqual(appended_path, sys.path[-1]) self.assertEqual(os.path.split(appended_path)[1], 'syspath')