Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skip tests that raise PermissionError in test_os (non-root user on Android) #73366

Closed
xdegaye mannequin opened this issue Jan 6, 2017 · 6 comments
Closed

skip tests that raise PermissionError in test_os (non-root user on Android) #73366

xdegaye mannequin opened this issue Jan 6, 2017 · 6 comments
Labels
3.7 tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@xdegaye
Copy link
Mannequin

xdegaye mannequin commented Jan 6, 2017

BPO 29180
Nosy @xdegaye, @berkerpeksag
PRs
  • bpo-29180: Skip test_os tests on PermissionError raised by Android #4374
  • Files
  • test_os.patch
  • issue29180_01.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2017-11-12.16:58:02.998>
    created_at = <Date 2017-01-06.15:14:52.715>
    labels = ['3.7', 'type-bug', 'tests']
    title = 'skip tests that raise PermissionError in test_os (non-root user on Android)'
    updated_at = <Date 2017-11-12.16:58:02.997>
    user = 'https://github.com/xdegaye'

    bugs.python.org fields:

    activity = <Date 2017-11-12.16:58:02.997>
    actor = 'xdegaye'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-11-12.16:58:02.998>
    closer = 'xdegaye'
    components = ['Tests']
    creation = <Date 2017-01-06.15:14:52.715>
    creator = 'xdegaye'
    dependencies = []
    files = ['46200', '46232']
    hgrepos = []
    issue_num = 29180
    keywords = ['patch']
    message_count = 6.0
    messages = ['284824', '284932', '284946', '284995', '285065', '306123']
    nosy_count = 2.0
    nosy_names = ['xdegaye', 'berker.peksag']
    pr_nums = ['4374']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue29180'
    versions = ['Python 3.7']

    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Jan 6, 2017

    ====================================================================== [1633/2616]
    ERROR: test_link (test.test_os.LinkTests)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_os.py", line 1703, in test_link
        self._test_link(self.file1, self.file2)
      File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_os.py", line 1698, in _test_link
        os.link(file1, file2)
    PermissionError: [Errno 13] Permission denied: '@test_2295_tmp' -> '@test_2295_tmp2'

    ======================================================================
    ERROR: test_link_bytes (test.test_os.LinkTests)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_os.py", line 1707, in test_link_bytes
        bytes(self.file2, sys.getfilesystemencoding()))
      File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_os.py", line 1698, in _test_link
        os.link(file1, file2)
    PermissionError: [Errno 13] Permission denied: b'@test_2295_tmp' -> b'@test_2295_tmp2'

    ======================================================================
    ERROR: test_unicode_name (test.test_os.LinkTests)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_os.py", line 1717, in test_unicode_name
        self._test_link(self.file1, self.file2)
      File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_os.py", line 1698, in _test_link
        os.link(file1, file2)
    PermissionError: [Errno 13] Permission denied: '@test_2295_tmpñ' -> '@test_2295_tmpñ2'

    ======================================================================
    ERROR: test_stty_match (test.test_os.TermsizeTests)
    Check if stty returns the same results
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_os.py", line 2795, in test_stty_match
        size = subprocess.check_output(['stty', 'size']).decode().split()
      File "/sdcard/org.bitbucket.pyona/lib/python3.7/subprocess.py", line 336, in check_output
        **kwargs).stdout
      File "/sdcard/org.bitbucket.pyona/lib/python3.7/subprocess.py", line 403, in run
        with Popen(*popenargs, **kwargs) as process:
      File "/sdcard/org.bitbucket.pyona/lib/python3.7/subprocess.py", line 707, in __init__
        restore_signals, start_new_session)
      File "/sdcard/org.bitbucket.pyona/lib/python3.7/subprocess.py", line 1323, in _execute_child
        raise child_exception_type(errno_num, err_msg)
    PermissionError: [Errno 13] Permission denied

    ======================================================================
    ERROR: test_attributes (test.test_os.TestScandir)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_os.py", line 3150, in test_attributes
        os.link(filename, os.path.join(self.path, "link_file.txt"))
    PermissionError: [Errno 13] Permission denied: '/data/local/tmp/test_python_2295/@test_2295_tmp/file
    .txt' -> '/data/local/tmp/test_python_2295/@test_2295_tmp/link_file.txt'

    Ran 238 tests in 4.675s

    FAILED (errors=5, skipped=40)
    test test_os failed

    @xdegaye xdegaye mannequin self-assigned this Jan 6, 2017
    @xdegaye xdegaye mannequin added 3.7 tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error labels Jan 6, 2017
    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Jan 7, 2017

    Patch attached.

    @berkerpeksag
    Copy link
    Member

    berkerpeksag commented Jan 8, 2017

    Are you planning to use test.support.os_link() to fix other tests in near future? If test_os is the only user of the helper, I'd say let's keep it in Lib/test/test_os.py for now. test.support is already big enough and it would be better not to put every snippet in it :)

    If there are other tests that can benefit from using it, the patch looks good to me.

    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Jan 8, 2017

    If test_os is the only user of the helper, I'd say let's keep it in Lib/test/test_os.py for now.

    I agree with that concern.

    support.os_link() is also used by a patch in bpo-29181, and I am planning to modify the changes made by bpo-28759 to also use it so that tests calling os.link() are skipped based on the fact that they raise PermissionError instead of based on the fact that they are being run by an Android non-root user as is currently the case.

    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Jan 9, 2017

    New patch following Serhiy's suggestion in msg285008.

    @xdegaye xdegaye mannequin removed their assignment Feb 3, 2017
    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Nov 12, 2017

    New changeset 6a55d09 by xdegaye in branch 'master':
    bpo-29180: Skip test_os tests on PermissionError raised by Android (GH-4374)
    6a55d09

    @xdegaye xdegaye mannequin closed this as completed Nov 12, 2017
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant