File: test_transport.py

package info (click to toggle)
smart-open 7.5.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 980 kB
  • sloc: python: 8,054; sh: 90; makefile: 14
file content (22 lines) | stat: -rw-r--r-- 787 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# -*- coding: utf-8 -*-
import pytest
import unittest

from smart_open.transport import register_transport, get_transport


class TransportTest(unittest.TestCase):

    def test_registry_requires_declared_schemes(self):
        with pytest.raises(ValueError):
            register_transport('tests.fixtures.no_schemes_transport')

    def test_registry_errors_on_double_register_scheme(self):
        register_transport('tests.fixtures.good_transport')
        with pytest.raises(AssertionError):
            register_transport('tests.fixtures.good_transport')

    def test_registry_errors_get_transport_for_module_with_missing_deps(self):
        register_transport('tests.fixtures.missing_deps_transport')
        with pytest.raises(ImportError):
            get_transport("missing")