Guest User

Untitled

a guest
Feb 19th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 KB | None | 0 0
  1. Mopy/ # no init.py !
  2. bash/
  3. __init__.py
  4. bash.py # <--- Edit: yep there is such a module too
  5. bass.py
  6. bosh/
  7. __init__.py # contains from .. import bass
  8. bsa_files.py
  9. ...
  10. test_bash
  11. __init__.py # code below
  12. test_bosh
  13. __init__.py
  14. test_bsa_files.py
  15.  
  16. import sys
  17. from os.path import dirname, abspath, join, sep
  18. mopy = dirname(dirname(abspath(__file__)))
  19. assert mopy.split(sep)[-1].lower() == 'mopy'
  20. sys.path.append(mopy)
  21. print 'Mopy folder appended to path: ', mopy
  22.  
  23. import unittest
  24. from unittest import TestCase
  25.  
  26. import bosh
  27.  
  28. class TestBSAHeader(TestCase):
  29. def test_read_header(self):
  30. bosh.bsa_files.Header.read_header()
  31.  
  32. if __name__ == '__main__':
  33. unittest.main()
  34.  
  35. python.exe "C:_JetBrainsPyCharm 2016.2.2helperspycharmutrunner.py" C:pathtoMopytest_bashtest_boshtest_bsa_files.py true
  36.  
  37. Traceback (most recent call last):
  38. File "C:_JetBrainsPyCharm 2016.2.2helperspycharmutrunner.py", line 124, in <module>
  39. modules = [loadSource(a[0])]
  40. File "C:_JetBrainsPyCharm 2016.2.2helperspycharmutrunner.py", line 43, in loadSource
  41. module = imp.load_source(moduleName, fileName)
  42. File "C:Dropboxeclipse_workspacespythonwrye-bashMopytest_bashtest_boshtest_bsa_files.py", line 4, in <module>
  43. import bosh
  44. File "C:Dropboxeclipse_workspacespythonwrye-bashMopybashbosh__init__.py", line 50, in <module>
  45. from .. import bass
  46. ValueError: Attempted relative import beyond toplevel package
  47.  
  48. if __name__ == '__main__':
  49. main()
  50.  
  51. C:_Python27python.exe "C:_JetBrainsPyCharm 2016.2.2helperspycharmutrunner.py" C:Dropboxeclipse_workspacespythonwrye-bashMopytest_bashtest_boshtest_bsa_files.py true
  52. Testing started at 3:45 PM ...
  53. usage: utrunner.py [-h] [-o OBLIVIONPATH] [-p PERSONALPATH] [-u USERPATH]
  54. [-l LOCALAPPDATAPATH] [-b] [-r] [-f FILENAME] [-q] [-i]
  55. [-I] [-g GAMENAME] [-d] [-C] [-P] [--no-uac] [--uac]
  56. [--bashmon] [-L LANGUAGE]
  57. utrunner.py: error: unrecognized arguments: C:Dropboxeclipse_workspacespythonwrye-bashMopytest_bashtest_boshtest_bsa_files.py true
  58.  
  59. Process finished with exit code 2
  60.  
  61. import bash.bosh
  62.  
  63. from bash import bosh
  64.  
  65. # test_bash__init__.py
  66. sys.path.insert(0, mopy)
  67.  
  68. import bosh
  69.  
  70. from .. import bass
  71.  
  72. import bash.bosh
  73.  
  74. from .. import bass
Add Comment
Please, Sign In to add comment