示例#1
0
def test_dotted_setup_call(temp_path: Path):
    path = temp_path / 'setup.py'
    with open(str(path), 'w') as f:
        f.write(
            dedent("""
        import setuptools
        setuptools.setup(name='foo')
        """))

    dist = SetupPyConverter()._execute(path)

    assert dist.get_name() == 'foo'
示例#2
0
def test_run_setup_function(temp_path: Path):
    path = temp_path / 'setup.py'
    with open(str(path), 'w') as f:
        f.write(
            dedent("""
        from setuptools import setup
        def run_setup():
            return setup(name='foo')

        if __name__ == '__main__':
            run_setup()
        """))

    dist = SetupPyConverter()._execute(path)

    assert dist.get_name() == 'foo'