question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Some tests fail because of wrong rights on /foo

See original GitHub issue
  • I am on the latest Poetry version.

  • I have searched the issues of this repo and believe that this is not a duplicate.

  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

  • OS version and name: openSUSE/Tumbleweed (Linux)

  • Poetry version: 1.0.0b8

Issue

Plenty of tests fail because of the traceback similar to this one (from ):

[   88s] ____________________________ test_add_no_constraint ____________________________
[   88s] 
[   88s] app = <tests.console.conftest.Application object at 0x7fd532dff4a8>
[   88s] repo = <tests.console.conftest.Repository object at 0x7fd532b587b8>
[   88s] installer = <poetry.installation.noop_installer.NoopInstaller object at 0x7fd532bc1470>
[   88s] 
[   88s]     def test_add_no_constraint(app, repo, installer):
[   88s]         command = app.find("add")
[   88s]         tester = CommandTester(command)
[   88s]     
[   88s]         repo.add_package(get_package("cachy", "0.1.0"))
[   88s]         repo.add_package(get_package("cachy", "0.2.0"))
[   88s]     
[   88s] >       tester.execute("cachy")
[   88s] 
[   88s] tests/console/commands/test_add.py:19: 
[   88s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[   88s] /usr/lib/python3.7/site-packages/cleo/testers/command_tester.py:61: in execute
[   88s]     self._status_code = command.run(args, self._io)
[   88s] /usr/lib/python3.7/site-packages/clikit/api/command/command.py:116: in run
[   88s]     return self.handle(self.parse(args), io)
[   88s] /usr/lib/python3.7/site-packages/clikit/api/command/command.py:120: in handle
[   88s]     status_code = self._do_handle(args, io)
[   88s] /usr/lib/python3.7/site-packages/clikit/api/command/command.py:163: in _do_handle
[   88s]     self._dispatcher.dispatch(PRE_HANDLE, event)
[   88s] /usr/lib/python3.7/site-packages/clikit/api/event/event_dispatcher.py:22: in dispatch
[   88s]     self._do_dispatch(listeners, event_name, event)
[   88s] /usr/lib/python3.7/site-packages/clikit/api/event/event_dispatcher.py:89: in _do_dispatch
[   88s]     listener(event, event_name, self)
[   88s] poetry/console/config/application_config.py:86: in set_env
[   88s]     env = env_manager.create_venv(io)
[   88s] poetry/utils/env.py:587: in create_venv
[   88s]     self.build_venv(str(venv), executable=executable)
[   88s] poetry/utils/env.py:647: in build_venv
[   88s]     build(path)
[   88s] /usr/lib64/python3.7/venv/__init__.py:60: in create
[   88s]     context = self.ensure_directories(env_dir)
[   88s] /usr/lib64/python3.7/venv/__init__.py:107: in ensure_directories
[   88s]     create_if_needed(env_dir)
[   88s] /usr/lib64/python3.7/venv/__init__.py:96: in create_if_needed
[   88s]     os.makedirs(d)
[   88s] /usr/lib64/python3.7/os.py:211: in makedirs
[   88s]     makedirs(head, exist_ok=exist_ok)
[   88s] /usr/lib64/python3.7/os.py:211: in makedirs
[   88s]     makedirs(head, exist_ok=exist_ok)
[   88s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[   88s] 
[   88s] name = '/foo', mode = 511, exist_ok = False
[   88s] 
[   88s]     def makedirs(name, mode=0o777, exist_ok=False):
[   88s]         """makedirs(name [, mode=0o777][, exist_ok=False])
[   88s]     
[   88s]         Super-mkdir; create a leaf directory and all intermediate ones.  Works like
[   88s]         mkdir, except that any intermediate path segment (not just the rightmost)
[   88s]         will be created if it does not exist. If the target directory already
[   88s]         exists, raise an OSError if exist_ok is False. Otherwise no exception is
[   88s]         raised.  This is recursive.
[   88s]     
[   88s]         """
[   88s]         head, tail = path.split(name)
[   88s]         if not tail:
[   88s]             head, tail = path.split(head)
[   88s]         if head and tail and not path.exists(head):
[   88s]             try:
[   88s]                 makedirs(head, exist_ok=exist_ok)
[   88s]             except FileExistsError:
[   88s]                 # Defeats race condition when another thread created the path
[   88s]                 pass
[   88s]             cdir = curdir
[   88s]             if isinstance(tail, bytes):
[   88s]                 cdir = bytes(curdir, 'ASCII')
[   88s]             if tail == cdir:           # xxx/newdir/. exists if xxx/newdir exists
[   88s]                 return
[   88s]         try:
[   88s] >           mkdir(name, mode)
[   88s] E           PermissionError: [Errno 13] Permission denied: '/foo'
[   88s] 
[   88s] /usr/lib64/python3.7/os.py:221: PermissionError

Complete build log

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:52 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
mpolanskicommented, Oct 20, 2020

Not recommending that. What I am saying is you need to run your tests in a virtual environment. We do not really support running the test suite under the system interpretor.

From the package maintainers’ point of view running the test suite using the system interpreter (and not in the virtual environment) is exactly what you want to do. This way you can test whether the software behaves correctly under the exact Python version that is currently packaged with all needed dependencies (that often have some downstream patches).

Eli by using arguments like --system-site-packages and --without-pip is effectively trying to create a virtual environment that behaves like there was none.

2reactions
eli-schwartzcommented, Oct 20, 2020

Why is this bug report closed just because some unrelated bug mentioned 6 comments in happens to be resolved?

The error seems to have moved around a bit, but I still cannot package poetry due to:

__________________ test_builder_should_execute_build_scripts ___________________

extended_without_setup_poetry = <poetry.poetry.Poetry object at 0x7fa15ce21790>

    def test_builder_should_execute_build_scripts(extended_without_setup_poetry):
        env = MockEnv(path=Path("/foo"))
        builder = EditableBuilder(extended_without_setup_poetry, env, NullIO())
    
>       builder.build()

tests/masonry/builders/test_editable_builder.py:214: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
poetry/masonry/builders/editable.py:57: in build
    added_files += self._add_scripts()
poetry/masonry/builders/editable.py:150: in _add_scripts
    with script_file.open("w", encoding="utf-8") as f:
/usr/lib/python3.8/pathlib.py:1221: in open
    return io.open(self, mode, buffering, encoding, errors, newline,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = PosixPath('/usr/bin/foo'), name = '/usr/bin/foo', flags = 524865
mode = 438

    def _opener(self, name, flags, mode=0o666):
        # A stub for the opener argument to built-in open()
>       return self._accessor.open(self, flags, mode)
E       PermissionError: [Errno 13] Permission denied: '/usr/bin/foo'

/usr/lib/python3.8/pathlib.py:1077: PermissionError
Read more comments on GitHub >

github_iconTop Results From Across the Web

Warning: Food Allergy Blood Tests Sometimes Unreliable
“The differences we saw in sensitivity and accuracy are clearly a red flag because reliance on results may lead to a wrong diagnosis,”...
Read more >
The myth of IgG food panel testing | AAAAI
This test, offered by various companies, reports IgG levels to multiple foods (usually 90 to 100 foods with a single panel test) claiming...
Read more >
The Flaws and Human Harms of Animal Experimentation - NCBI
The main causes of failure are lack of effectiveness and safety problems that were not predicted by animal tests.
Read more >
10 Dangerous Food Safety Mistakes | CDC
Protect your family from food poisoning by avoiding these common food safety mistakes.
Read more >
Skin Prick Tests - FoodAllergy.org
SPTs seldom produce “false negatives” (erroneous results indicating that you are not allergic to a food, even though you really are). Negative results...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found