Skip to content

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

Closed

Description

@xdegaye
mannequin
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']

    Activity

    1. xdegaye commented on Jan 6, 2017

      xdegayemannequin
      MannequinAuthor

      ====================================================================== [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

    2. self-assigned this
      on Jan 6, 2017
    3. added
      testsTests in the Lib/test dir
      type-bugAn unexpected behavior, bug, or error
      on Jan 6, 2017
    4. xdegaye commented on Jan 7, 2017

      xdegayemannequin
      MannequinAuthor

      Patch attached.

    5. berkerpeksag commented on Jan 8, 2017

      @berkerpeksag
      Member

      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.

    6. xdegaye commented on Jan 8, 2017

      xdegayemannequin
      MannequinAuthor

      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.

    7. xdegaye commented on Jan 9, 2017

      xdegayemannequin
      MannequinAuthor

      New patch following Serhiy's suggestion in msg285008.

    8. removed their assignment
      on Feb 3, 2017
    9. xdegaye commented on Nov 12, 2017

      xdegayemannequin
      MannequinAuthor

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

    10. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.7 (EOL)end of lifetestsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions