8000 fix tests failures on Win32. by mindw · Pull Request #658 · sigmavirus24/github3.py · GitHub
[go: up one dir, main page]

Skip to content

fix tests failures on Win32. #658

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

Merged
merged 1 commit into from
Dec 26, 2016

Conversation

mindw
Copy link
Contributor
@mindw mindw commented Dec 25, 2016

No description provided.

@sigmavirus24
Copy link
Owner

What is the exact failure you see on Windows?

@mindw
Copy link
Contributor Author
mindw commented Dec 25, 2016

http://bugs.python.org/issue6875

___________________________ TestAsset.test_download ___________________________

self = <tests.integration.test_repos_release.TestAsset testMethod=test_download>

    def test_download(self):
        """Test the ability to download an asset."""
        cassette_name = self.cassette_name('download')
        with self.recorder.use_cassette(cassette_name,
                                        preserve_exact_body_bytes=True,
                                        **self.betamax_simple_body):
            repository = self.gh.repository('sigmavirus24', 'github3.py')
            release = repository.release(76677)
            asset = next(release.assets())
            _, filename = tempfile.mkstemp()
            asset.download(filename)

        with open(filename, 'rb') as fd:
            assert len(fd.read(1024)) > 0

>       os.unlink(filename)
E       PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\GABIDA~1\\AppData\\Local\\Temp\\tmpvoujn_k_'

tests\integration\test_repos_release.py:144: PermissionError
_________________ TestAsset.test_download_when_authenticated __________________

self = <tests.integration.test_repos_release.TestAsset testMethod=test_download_when_authenticated>

    def test_download_when_authenticated(self):
        """Test the ability to download an asset when authenticated."""
        self.basic_login()
        cassette_name = self.cassette_name('download_when_authenticated')
        with self.recorder.use_cassette(cassette_name,
                                        preserve_exact_body_bytes=True,
                                        **self.betamax_simple_body):
            repository = self.gh.repository('sigmavirus24', 'github3.py')
            release = repository.release(76677)
            asset = next(release.assets())
            _, filename = tempfile.mkstemp()
            assert asset.session.auth is not None
            asset.download(filename)
            assert asset.session.auth is not None

        with open(filename, 'rb') as fd:
            assert len(fd.read(1024)) > 0

>       os.unlink(filename)
E       PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\GABIDA~1\\AppData\\Local\\Temp\\tmps7c7mksu'

@sigmavirus24
Copy link
Owner

Thanks for the detail and the fix @mindw!

@sigmavirus24 sigmavirus24 merged commit a334dbc into sigmavirus24:develop Dec 26, 2016
@mindw mindw deleted the win32_test_fix branch December 26, 2016 18:16
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.

2 participants
0