Exemple #1
0
    def test_get_paths(self):
        archive = Archive('test.zip')
        paths = archive._get_paths()
        ok_(os.path.join(self.pj_root, 'lamvery') in paths)

        archive = Archive('test.zip', no_libs=True)
        paths = archive._get_paths()
        ok_(os.path.join(self.pj_root, 'lamvery') in paths)
        ok_(os.path.join(self.pj_root, 'lambda_function.py') in paths)
        ok_(os.path.join(self.pj_root, 'lambda_function.pyc') in paths)
        ok_(os.path.join(self.pj_root, '.lamvery.yml') in paths)

        archive = Archive('test.zip', function_filename='test.py', single_file=True)
        paths = archive._get_paths()
        ok_(os.path.join(self.pj_root, 'test.py') in paths)
        ok_(not os.path.join(self.pj_root, 'lambda_function.pyc') in paths)
        ok_(not os.path.join(self.pj_root, '.lamvery.yml') in paths)

        del os.environ['VIRTUAL_ENV']
        archive = Archive('test.zip')
        paths = archive._get_paths()
        ok_(os.path.join(self.pj_root, 'lamvery') in paths)
Exemple #2
0
    def test_get_paths(self):
        archive = Archive('test.zip')
        paths = archive._get_paths()
        ok_(os.path.join(self.pj_root, 'lamvery') in paths)

        archive = Archive('test.zip', no_libs=True)
        paths = archive._get_paths()
        ok_(os.path.join(self.pj_root, 'lamvery') in paths)
        ok_(os.path.join(self.pj_root, 'lambda_function.py') in paths)
        ok_(os.path.join(self.pj_root, 'lambda_function.pyc') in paths)
        ok_(os.path.join(self.pj_root, '.lamvery.yml') in paths)

        archive = Archive('test.zip',
                          function_filename='test.py',
                          single_file=True)
        paths = archive._get_paths()
        ok_(os.path.join(self.pj_root, 'test.py') in paths)
        ok_(not os.path.join(self.pj_root, 'lambda_function.pyc') in paths)
        ok_(not os.path.join(self.pj_root, '.lamvery.yml') in paths)

        del os.environ['VIRTUAL_ENV']
        archive = Archive('test.zip')
        paths = archive._get_paths()
        ok_(os.path.join(self.pj_root, 'lamvery') in paths)