Skip to content

Commit

Permalink
BF+WIN: Protect against missing os.geteuid() on windows (fixes gh-2529)
Browse files Browse the repository at this point in the history
  • Loading branch information
mih committed May 23, 2018
1 parent c81c613 commit fc9daa7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
9 changes: 3 additions & 6 deletions datalad/distribution/tests/test_clone.py
Expand Up @@ -17,23 +17,22 @@
slow
)


import os
from os.path import join as opj
from os.path import isdir
from os.path import exists
from os.path import basename
from os.path import dirname
from os import mkdir
from os import chmod
from os import geteuid

from mock import patch

from datalad.api import create
from datalad.api import clone
from datalad.utils import chpwd
from datalad.utils import _path_
from datalad.utils import rmtree
from datalad.utils import on_windows
from datalad.support.exceptions import IncompleteResultsError
from datalad.support.gitrepo import GitRepo
from datalad.support.annexrepo import AnnexRepo
Expand All @@ -58,7 +57,6 @@
from datalad.tests.utils import serve_path_via_http
from datalad.tests.utils import use_cassette
from datalad.tests.utils import skip_if_no_network
from datalad.tests.utils import skip_if_on_windows
from datalad.tests.utils import skip_if

from ..dataset import Dataset
Expand Down Expand Up @@ -333,8 +331,7 @@ def test_clone_isnt_a_smartass(origin_path, path):
eq_(cloned.subdatasets(), [])


@skip_if_on_windows
@skip_if(not geteuid(), "Will fail under super-user")
@skip_if(on_windows or not os.geteuid(), "Will fail under super-user")
@with_tempfile(mkdir=True)
def test_clone_report_permission_issue(tdir):
pdir = _path_(tdir, 'protected')
Expand Down
6 changes: 1 addition & 5 deletions datalad/interface/tests/test_unlock.py
Expand Up @@ -12,8 +12,6 @@

__docformat__ = 'restructuredtext'

import logging
from os import geteuid
from os.path import join as opj

from datalad.distribution.dataset import Dataset
Expand All @@ -29,11 +27,9 @@
from datalad.tests.utils import chpwd
from datalad.tests.utils import assert_cwd_unchanged
from datalad.tests.utils import with_testrepos
from datalad.tests.utils import assert_in
from datalad.tests.utils import on_windows, skip_if
from datalad.tests.utils import known_failure_v6
from datalad.tests.utils import assert_status, assert_result_count, assert_in_results
from datalad.utils import swallow_logs


@assert_cwd_unchanged
Expand Down Expand Up @@ -72,7 +68,7 @@ def test_unlock_raises(path, path2, path3):
@known_failure_v6 # FIXME: See TODOs in the comments below
# Note: As root there is no actual lock/unlock.
# Therefore don't know what to test for yet.
@skip_if(cond=not on_windows and geteuid() == 0) # uid not available on windows
@skip_if(cond=not on_windows and os.geteuid() == 0) # uid not available on windows
@with_testrepos('.*annex.*', flavors=['clone'])
def test_unlock(path):

Expand Down

0 comments on commit fc9daa7

Please sign in to comment.