Пример #1
0
    def test_makemessages_find_files(self):
        """
        Test that find_files only discover files having the proper extensions.
        """
        from django.core.management.commands.makemessages import Command
        cmd = Command()
        cmd.ignore_patterns = ['CVS', '.*', '*~', '*.pyc']
        cmd.symlinks = False
        cmd.domain = 'django'
        cmd.extensions = ['html', 'txt', 'py']
        cmd.verbosity = 0
        cmd.locale_paths = []
        cmd.default_locale_path = os.path.join(self.test_dir, 'locale')
        found_files = cmd.find_files(self.test_dir)
        found_exts = set(
            [os.path.splitext(tfile.file)[1] for tfile in found_files])
        self.assertEqual(found_exts.difference({'.py', '.html', '.txt'}),
                         set())

        cmd.extensions = ['js']
        cmd.domain = 'djangojs'
        found_files = cmd.find_files(self.test_dir)
        found_exts = set(
            [os.path.splitext(tfile.file)[1] for tfile in found_files])
        self.assertEqual(found_exts.difference({'.js'}), set())
Пример #2
0
    def test_makemessages_find_files(self):
        """
        Test that find_files only discover files having the proper extensions.
        """
        cmd = MakeMessagesCommand()
        cmd.ignore_patterns = ['CVS', '.*', '*~', '*.pyc']
        cmd.symlinks = False
        cmd.domain = 'django'
        cmd.extensions = ['html', 'txt', 'py']
        cmd.verbosity = 0
        cmd.locale_paths = []
        cmd.default_locale_path = os.path.join(self.test_dir, 'locale')
        found_files = cmd.find_files(self.test_dir)
        found_exts = set([os.path.splitext(tfile.file)[1] for tfile in found_files])
        self.assertEqual(found_exts.difference({'.py', '.html', '.txt'}), set())

        cmd.extensions = ['js']
        cmd.domain = 'djangojs'
        found_files = cmd.find_files(self.test_dir)
        found_exts = set([os.path.splitext(tfile.file)[1] for tfile in found_files])
        self.assertEqual(found_exts.difference({'.js'}), set())
Пример #3
0
    def test_makemessages_find_files(self):
        """
        find_files only discover files having the proper extensions.
        """
        cmd = MakeMessagesCommand()
        cmd.ignore_patterns = ["CVS", ".*", "*~", "*.pyc"]
        cmd.symlinks = False
        cmd.domain = "django"
        cmd.extensions = ["html", "txt", "py"]
        cmd.verbosity = 0
        cmd.locale_paths = []
        cmd.default_locale_path = os.path.join(self.test_dir, "locale")
        found_files = cmd.find_files(self.test_dir)
        found_exts = {os.path.splitext(tfile.file)[1] for tfile in found_files}
        self.assertEqual(found_exts.difference({".py", ".html", ".txt"}), set())

        cmd.extensions = ["js"]
        cmd.domain = "djangojs"
        found_files = cmd.find_files(self.test_dir)
        found_exts = {os.path.splitext(tfile.file)[1] for tfile in found_files}
        self.assertEqual(found_exts.difference({".js"}), set())
Пример #4
0
    def test_makemessages_find_files(self):
        """
        Test that find_files only discover files having the proper extensions.
        """
        cmd = MakeMessagesCommand()
        cmd.ignore_patterns = ["CVS", ".*", "*~", "*.pyc"]
        cmd.symlinks = False
        cmd.domain = "django"
        cmd.extensions = ["html", "txt", "py"]
        cmd.verbosity = 0
        cmd.locale_paths = []
        cmd.default_locale_path = os.path.join(self.test_dir, "locale")
        found_files = cmd.find_files(self.test_dir)
        found_exts = set([os.path.splitext(tfile.file)[1] for tfile in found_files])
        self.assertEqual(found_exts.difference({".py", ".html", ".txt"}), set())

        cmd.extensions = ["js"]
        cmd.domain = "djangojs"
        found_files = cmd.find_files(self.test_dir)
        found_exts = set([os.path.splitext(tfile.file)[1] for tfile in found_files])
        self.assertEqual(found_exts.difference({".js"}), set())