Properly escape regex
parent
bd33e1d402
commit
22d9641908
|
@ -1091,7 +1091,7 @@ class TestDockerBuildCommand(TestCase):
|
|||
cmd.get_wrapped_command(),
|
||||
('/bin/sh -c '
|
||||
"'cd /tmp/foobar && PATH=/tmp/foo:$PATH "
|
||||
"python /tmp/foo/pip install Django\>1.7'"),
|
||||
r"python /tmp/foo/pip install Django\>1.7'"),
|
||||
)
|
||||
|
||||
def test_unicode_output(self):
|
||||
|
|
|
@ -63,26 +63,26 @@ class Testmaker(APITestCase):
|
|||
self.assertEqual(r.data['version_compare'], {'MOCKED': True})
|
||||
|
||||
def test_pdf_build_mentioned_in_footer(self):
|
||||
with fake_paths_by_regex('\.pdf$'):
|
||||
with fake_paths_by_regex(r'\.pdf$'):
|
||||
response = self.render()
|
||||
self.assertIn('pdf', response.data['html'])
|
||||
|
||||
def test_pdf_not_mentioned_in_footer_when_build_is_disabled(self):
|
||||
self.pip.enable_pdf_build = False
|
||||
self.pip.save()
|
||||
with fake_paths_by_regex('\.pdf$'):
|
||||
with fake_paths_by_regex(r'\.pdf$'):
|
||||
response = self.render()
|
||||
self.assertNotIn('pdf', response.data['html'])
|
||||
|
||||
def test_epub_build_mentioned_in_footer(self):
|
||||
with fake_paths_by_regex('\.epub$'):
|
||||
with fake_paths_by_regex(r'\.epub$'):
|
||||
response = self.render()
|
||||
self.assertIn('epub', response.data['html'])
|
||||
|
||||
def test_epub_not_mentioned_in_footer_when_build_is_disabled(self):
|
||||
self.pip.enable_epub_build = False
|
||||
self.pip.save()
|
||||
with fake_paths_by_regex('\.epub$'):
|
||||
with fake_paths_by_regex(r'\.epub$'):
|
||||
response = self.render()
|
||||
self.assertNotIn('epub', response.data['html'])
|
||||
|
||||
|
|
|
@ -54,32 +54,32 @@ class TestProject(ProjectMixin, TestCase):
|
|||
|
||||
def test_has_pdf(self):
|
||||
# The project has a pdf if the PDF file exists on disk.
|
||||
with fake_paths_by_regex('\.pdf$'):
|
||||
with fake_paths_by_regex(r'\.pdf$'):
|
||||
self.assertTrue(self.pip.has_pdf(LATEST))
|
||||
|
||||
# The project has no pdf if there is no file on disk.
|
||||
with fake_paths_by_regex('\.pdf$', exists=False):
|
||||
with fake_paths_by_regex(r'\.pdf$', exists=False):
|
||||
self.assertFalse(self.pip.has_pdf(LATEST))
|
||||
|
||||
def test_has_pdf_with_pdf_build_disabled(self):
|
||||
# The project has NO pdf if pdf builds are disabled
|
||||
self.pip.enable_pdf_build = False
|
||||
with fake_paths_by_regex('\.pdf$'):
|
||||
with fake_paths_by_regex(r'\.pdf$'):
|
||||
self.assertFalse(self.pip.has_pdf(LATEST))
|
||||
|
||||
def test_has_epub(self):
|
||||
# The project has a epub if the PDF file exists on disk.
|
||||
with fake_paths_by_regex('\.epub$'):
|
||||
with fake_paths_by_regex(r'\.epub$'):
|
||||
self.assertTrue(self.pip.has_epub(LATEST))
|
||||
|
||||
# The project has no epub if there is no file on disk.
|
||||
with fake_paths_by_regex('\.epub$', exists=False):
|
||||
with fake_paths_by_regex(r'\.epub$', exists=False):
|
||||
self.assertFalse(self.pip.has_epub(LATEST))
|
||||
|
||||
def test_has_epub_with_epub_build_disabled(self):
|
||||
# The project has NO epub if epub builds are disabled
|
||||
self.pip.enable_epub_build = False
|
||||
with fake_paths_by_regex('\.epub$'):
|
||||
with fake_paths_by_regex(r'\.epub$'):
|
||||
self.assertFalse(self.pip.has_epub(LATEST))
|
||||
|
||||
@patch('readthedocs.projects.models.Project.find')
|
||||
|
|
Loading…
Reference in New Issue