diff --git a/tests/cmd/fixtures/large-number-of-jobs-001.yaml b/tests/cmd/fixtures/large-number-of-jobs-001.yaml
new file mode 100644
index 000000000..26aa77c27
--- /dev/null
+++ b/tests/cmd/fixtures/large-number-of-jobs-001.yaml
@@ -0,0 +1,10 @@
+- job-template:
+    name: '{name}-{a}-{b}-{c}'
+
+- project:
+    name: project-name
+    a: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
+    b: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
+    c: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
+    jobs:
+      - '{name}-{a}-{b}-{c}'
diff --git a/tests/cmd/subcommands/test_test.py b/tests/cmd/subcommands/test_test.py
index a1625ca38..27c2839c9 100644
--- a/tests/cmd/subcommands/test_test.py
+++ b/tests/cmd/subcommands/test_test.py
@@ -74,6 +74,22 @@ class TestTests(CmdTestsBase):
                               'r', encoding='utf-8').read()
         self.assertEqual(console_out.getvalue().decode('utf-8'), xml_content)
 
+    def test_stream_input_output_no_encoding_exceed_recursion(self):
+        """
+        Test that we don't have issues processing large number of jobs and
+        outputting the result if the encoding is not set.
+        """
+        console_out = io.BytesIO()
+
+        input_file = os.path.join(self.fixtures_path,
+                                  'large-number-of-jobs-001.yaml')
+        with io.open(input_file, 'r') as f:
+            with mock.patch('sys.stdout', console_out):
+                console_out.encoding = None
+                with mock.patch('sys.stdin', f):
+                    args = ['test']
+                    self.execute_jenkins_jobs_with_args(args)
+
     def test_stream_input_output_utf8_encoding(self):
         """
         Run test mode simulating using pipes for input and output using