Skip to content

Commit

Permalink
Tests. Remove sys.path hack, use absolute imports
Browse files Browse the repository at this point in the history
  • Loading branch information
diyan committed Sep 1, 2013
1 parent 4599a89 commit 6132dcb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ env/
~temp/
*~

/tests/config.json
/winrm/tests/config.json
10 changes: 2 additions & 8 deletions winrm/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
import os
import json
import sys
from pytest import skip, fixture


def pytest_cmdline_preparse(config, args):
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../../winrm'))
sys.path.insert(0, os.path.dirname(__file__))


@fixture(scope='module')
def winrm_real(request):
def winrm_real():
config_path = os.path.join(os.path.dirname(__file__), 'config.json')
if os.path.isfile(config_path):
# TODO consider replace json with yaml for integration test settings
# TODO json does not support comments
settings = json.load(open(config_path))

from winrm_service import WinRMWebService
from winrm.winrm_service import WinRMWebService
winrm = WinRMWebService(**settings)
return winrm
else:
Expand Down
2 changes: 1 addition & 1 deletion winrm/tests/test_winrm_primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def winrm(request):
uuid4_mock.return_value = uuid.UUID(
'11111111-1111-1111-1111-111111111111')

from winrm_service import WinRMWebService
from winrm.winrm_service import WinRMWebService

winrm = WinRMWebService(
endpoint='http://windows-host:5985/wsman',
Expand Down

0 comments on commit 6132dcb

Please sign in to comment.