Skip to content

Commit 215dc14

Browse files
committed
Update tests
1 parent 299fc13 commit 215dc14

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

readthedocs/rtd_tests/tests/test_doc_building.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from unittest.mock import Mock, PropertyMock, mock_open, patch
1414

1515
import pytest
16-
from django.test import TestCase
16+
from django.test import TestCase, override_settings
1717
from django_dynamic_fixture import get
1818
from docker.errors import APIError as DockerAPIError
1919
from docker.errors import DockerException
@@ -356,6 +356,7 @@ def test_failing_execution_with_unexpected_exception(self):
356356
})
357357

358358

359+
@override_settings(RTD_DOCKER_WORKDIR='/tmp/')
359360
class TestDockerBuildEnvironment(TestCase):
360361

361362
"""Test docker build environment."""
@@ -699,7 +700,8 @@ def test_command_execution(self):
699700

700701
self.mocks.docker_client.exec_create.assert_called_with(
701702
container='build-123-project-6-pip',
702-
cmd="/bin/sh -c 'cd /tmp && echo\\ test'",
703+
cmd="/bin/sh -c 'echo\\ test'",
704+
workdir='/tmp',
703705
environment=mock.ANY,
704706
user='docs:docs',
705707
stderr=True,
@@ -759,7 +761,8 @@ def test_command_not_recorded(self):
759761

760762
self.mocks.docker_client.exec_create.assert_called_with(
761763
container='build-123-project-6-pip',
762-
cmd="/bin/sh -c 'cd /tmp && echo\\ test'",
764+
cmd="/bin/sh -c 'echo\\ test'",
765+
workdir='/tmp',
763766
environment=mock.ANY,
764767
user='docs:docs',
765768
stderr=True,
@@ -806,7 +809,8 @@ def test_record_command_as_success(self):
806809

807810
self.mocks.docker_client.exec_create.assert_called_with(
808811
container='build-123-project-6-pip',
809-
cmd="/bin/sh -c 'cd /tmp && echo\\ test'",
812+
cmd="/bin/sh -c 'echo\\ test'",
813+
workdir='/tmp',
810814
environment=mock.ANY,
811815
user='docs:docs',
812816
stderr=True,
@@ -1010,6 +1014,7 @@ def test_container_timeout(self):
10101014
})
10111015

10121016

1017+
@override_settings(RTD_DOCKER_WORKDIR='/tmp/')
10131018
class TestBuildCommand(TestCase):
10141019

10151020
"""Test build command creation."""
@@ -1090,6 +1095,7 @@ def test_unicode_output(self, mock_subprocess):
10901095
)
10911096

10921097

1098+
@override_settings(RTD_DOCKER_WORKDIR='/tmp/')
10931099
class TestDockerBuildCommand(TestCase):
10941100

10951101
"""Test docker build commands."""
@@ -1109,7 +1115,7 @@ def test_wrapped_command(self):
11091115
)
11101116
self.assertEqual(
11111117
cmd.get_wrapped_command(),
1112-
"/bin/sh -c 'cd /tmp/foobar && pip install requests'",
1118+
"/bin/sh -c 'pip install requests'",
11131119
)
11141120
cmd = DockerBuildCommand(
11151121
['python', '/tmp/foo/pip', 'install', 'Django>1.7'],
@@ -1120,7 +1126,7 @@ def test_wrapped_command(self):
11201126
cmd.get_wrapped_command(),
11211127
(
11221128
'/bin/sh -c '
1123-
"'cd /tmp/foobar && PATH=/tmp/foo:$PATH "
1129+
"'PATH=/tmp/foo:$PATH "
11241130
r"python /tmp/foo/pip install Django\>1.7'"
11251131
),
11261132
)

0 commit comments

Comments
 (0)