test_init.py 854 B

12345678910111213141516171819202122232425262728293031
  1. #!/usr/bin/env python3
  2. #
  3. # MMGen Wallet, a terminal-based cryptocurrency wallet
  4. # Copyright (C)2013-2024 The MMGen Project <mmgen@tuta.io>
  5. # Licensed under the GNU General Public License, Version 3:
  6. # https://www.gnu.org/licenses
  7. # Public project repositories:
  8. # https://github.com/mmgen/mmgen-wallet
  9. # https://gitlab.com/mmgen/mmgen-wallet
  10. """
  11. test.include.test_init: Initialization module for test scripts
  12. """
  13. import sys, os
  14. from pathlib import PurePath
  15. os.environ['MMGEN_TEST_SUITE'] = '1'
  16. repo_root = str(PurePath(*PurePath(__file__).parts[:-3]))
  17. os.chdir(repo_root)
  18. sys.path[0] = repo_root
  19. from test.overlay import overlay_setup
  20. overlay_root = overlay_setup(repo_root)
  21. os.environ['PYTHONPATH'] = overlay_root
  22. if 'TMUX' in os.environ:
  23. del os.environ['TMUX']
  24. if os.getenv('MMGEN_DEVTOOLS'):
  25. from mmgen.devinit import init_dev
  26. init_dev()