Skip to content

[v7r2] Adapt Test_FilePlugin.py for https://bugs.python.org/issue43219 - #5381

Merged
atsareg merged 2 commits into
DIRACGrid:rel-v7r2from
chrisburr:fix-bpo-43219
Sep 3, 2021
Merged

[v7r2] Adapt Test_FilePlugin.py for https://bugs.python.org/issue43219#5381
atsareg merged 2 commits into
DIRACGrid:rel-v7r2from
chrisburr:fix-bpo-43219

Conversation

@chrisburr

Copy link
Copy Markdown
Member

One of the unit tests has started failing as in Python 3.9.7+ shutil.copy was fixed to raise FileNotFoundError instead of IsADirectoryError, see:

It's an issue with the test code itself and not DIRAC.

Old behavour:

$ python --version
Python 3.9.5
$ python -c 'import shutil; shutil.copy2("/tmp/tmpajr883ky/subDir", "/tmp/tmpcu9phq73/test/subDir")'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/cburr/miniconda3/envs/dirac-development/lib/python3.9/shutil.py", line 435, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/home/cburr/miniconda3/envs/dirac-development/lib/python3.9/shutil.py", line 264, in copyfile
    with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst:
IsADirectoryError: [Errno 21] Is a directory: '/tmp/tmpajr883ky/subDir'

New behavour:

$ python --version
Python 3.9.7
$ python -c 'import shutil; shutil.copy2("/tmp/tmpajr883ky/subDir", "/tmp/tmpcu9phq73/test/subDir")'
Traceback (most recent call last):
  File "/home/cburr/miniconda3/envs/dirac-development-2/lib/python3.9/shutil.py", line 265, in copyfile
    with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst:
IsADirectoryError: [Errno 21] Is a directory: '/tmp/tmpajr883ky/subDir'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/cburr/miniconda3/envs/dirac-development-2/lib/python3.9/shutil.py", line 443, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/home/cburr/miniconda3/envs/dirac-development-2/lib/python3.9/shutil.py", line 293, in copyfile
    raise FileNotFoundError(f'Directory does not exist: {dst}') from e
FileNotFoundError: Directory does not exist: /tmp/tmpcu9phq73/test/subDir/subDir

@chaen @atsareg Please can you review+merge+propagate this quickly the get the CI passing again.

@atsareg
atsareg merged commit cb03a8e into DIRACGrid:rel-v7r2 Sep 3, 2021
@chrisburr
chrisburr deleted the fix-bpo-43219 branch September 3, 2021 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants