Scrapy, a fast high-level web crawling & scraping framework for Python.
Merge pull request #4676 from Gallaecio/startproject-existing-folder
Andrey Rahmatullinada539a63a26
diff --cc tests/test_commands.pyindex eec1f02ee,10a3aa16c..74b917d93--- a/tests/test_commands.py+++ b/tests/test_commands.py@@@ -128,15 -130,30 +136,34 @@@ class StartprojectTest(ProjectTest)self.assertEqual(2, self.call('startproject'))self.assertEqual(2, self.call('startproject', self.project_name, project_dir, 'another_params'))+ def test_existing_project_dir(self):+ project_dir = mkdtemp()+ project_name = self.project_name + '_existing'+ project_path = os.path.join(project_dir, project_name)+ os.mkdir(project_path)++ p, out, err = self.proc('startproject', project_name, cwd=project_dir)+ print(out)+ print(err, file=sys.stderr)+ self.assertEqual(p.returncode, 0)++ assert exists(join(abspath(project_path), 'scrapy.cfg'))+ assert exists(join(abspath(project_path), project_name))+ assert exists(join(join(abspath(project_path), project_name), '__init__.py'))+ assert exists(join(join(abspath(project_path), project_name), 'items.py'))+ assert exists(join(join(abspath(project_path), project_name), 'pipelines.py'))+ assert exists(join(join(abspath(project_path), project_name), 'settings.py'))+ assert exists(join(join(abspath(project_path), project_name), 'spiders', '__init__.py'))+def get_permissions_dict(path, renamings=None, ignore=None):++ def get_permissions(path):+ return oct(os.stat(path).st_mode)+renamings = renamings or tuple()permissions_dict = {- '.': os.stat(path).st_mode,+ '.': get_permissions(path),}for root, dirs, files in os.walk(path):nodes = list(chain(dirs, files))