def test_index_url(self): script = textwrap.dedent(''' __requires__ = ['foo'] __index_url__ = 'https://my.private.index/' ''') reqs = scripts.DepsReader(script).read() assert reqs.index_url == 'https://my.private.index/'
def test_dependency_links(self): script = textwrap.dedent(''' __requires__ = ['foo==0.42'] __dependency_links__ = ['git+ssh://[email protected]/repo.git#egg=foo-0.42'] ''') reqs = scripts.DepsReader(script).read() assert reqs.dependency_links == [ 'git+ssh://[email protected]/repo.git#egg=foo-0.42' ]
def test_fstrings_allowed(self): """ It should be possible to read dependencies from a script with f-strings on all Pythons. """ script = textwrap.dedent(''' # coding: future_fstrings __requires__ = 'foo' f'boo' f'coo' ''').lstrip() reqs = scripts.DepsReader(script).read() assert reqs == ['foo']
def test_single_dep(self): script = textwrap.dedent(''' __requires__='foo' ''') assert scripts.DepsReader(script).read() == ['foo']
def test_reads_files_with_multiple_assignment(self): script = textwrap.dedent(''' __requires__=['foo'] x, a = [a, x] ''') assert scripts.DepsReader(script).read() == ['foo']
def test_reads_files_with_attribute_assignment(self): script = textwrap.dedent(''' __requires__=['foo'] x.a = 'bar' ''') assert scripts.DepsReader(script).read() == ['foo']