File: test_upload.py

package info (click to toggle)
python-setuptools 44.1.1-1
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 3,536 kB
  • sloc: python: 25,461; ansic: 196; makefile: 88; xml: 14
file content (22 lines) | stat: -rw-r--r-- 552 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from setuptools.command.upload import upload
from setuptools.dist import Distribution
from setuptools.errors import RemovedCommandError

try:
    from unittest import mock
except ImportError:
    import mock

import pytest


class TestUpload:
    def test_upload_exception(self):
        """Ensure that the register command has been properly removed."""
        dist = Distribution()
        dist.dist_files = [(mock.Mock(), mock.Mock(), mock.Mock())]

        cmd = upload(dist)

        with pytest.raises(RemovedCommandError):
            cmd.run()