Code Duplication    Length = 17-18 lines in 2 locations

tests/test_hooks.py 2 locations

@@ 51-68 (lines=18) @@
48
        os.chmod(filename, os.stat(filename).st_mode | stat.S_IXUSR)
49
50
    # Adding an additional pre script
51
    if multiple_hooks:
52
        if sys.platform.startswith('win'):
53
            pre = 'pre_gen_project.bat'
54
            with open(os.path.join(hook_dir, pre), 'w') as f:
55
                f.write("@echo off\n")
56
                f.write("\n")
57
                f.write("echo post generation hook\n")
58
                f.write("echo. >shell_pre.txt\n")
59
        else:
60
            pre = 'pre_gen_project.sh'
61
            filename = os.path.join(hook_dir, pre)
62
            with open(filename, 'w') as f:
63
                f.write("#!/bin/bash\n")
64
                f.write("\n")
65
                f.write("echo 'post generation hook';\n")
66
                f.write("touch 'shell_pre.txt'\n")
67
            # Set the execute bit
68
            os.chmod(filename, os.stat(filename).st_mode | stat.S_IXUSR)
69
70
    return post
71
@@ 32-48 (lines=17) @@
29
        f.write("f = open('python_pre.txt', 'w')\n")
30
        f.write("f.close()\n")
31
32
    if sys.platform.startswith('win'):
33
        post = 'post_gen_project.bat'
34
        with open(os.path.join(hook_dir, post), 'w') as f:
35
            f.write("@echo off\n")
36
            f.write("\n")
37
            f.write("echo post generation hook\n")
38
            f.write("echo. >shell_post.txt\n")
39
    else:
40
        post = 'post_gen_project.sh'
41
        filename = os.path.join(hook_dir, post)
42
        with open(filename, 'w') as f:
43
            f.write("#!/bin/bash\n")
44
            f.write("\n")
45
            f.write("echo 'post generation hook';\n")
46
            f.write("touch 'shell_post.txt'\n")
47
        # Set the execute bit
48
        os.chmod(filename, os.stat(filename).st_mode | stat.S_IXUSR)
49
50
    # Adding an additional pre script
51
    if multiple_hooks: