avocado-framework/avocado

View on GitHub
selftests/functional/test_output_check.py

Summary

Maintainability
F
1 wk
Test Coverage

File test_output_check.py has 338 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import json
import os
import unittest

from avocado.core import exit_codes
Severity: Minor
Found in selftests/functional/test_output_check.py - About 4 hrs to fix

    Function test_output_diff has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def test_output_diff(self):
            self._check_output_record_all()
            tampered_msg_stdout = b"I PITY THE FOOL THAT STANDS ON STDOUT!"
            tampered_msg_stderr = b"I PITY THE FOOL THAT STANDS ON STDERR!"
    
    
    Severity: Minor
    Found in selftests/functional/test_output_check.py - About 1 hr to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          def test_merge_records_different_output(self):
              simple_test, variants_file = self._setup_simple_test(
                  TEST_WITH_DIFFERENT_EXPECTED_OUTPUT)
              cmd_line = ('%s run --job-results-dir %s --disable-sysinfo %s '
                          '--test-runner=runner '
      Severity: Major
      Found in selftests/functional/test_output_check.py and 1 other location - About 1 day to fix
      selftests/functional/test_output_check.py on lines 378..391

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 143.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          def test_merge_records_different_and_same_output(self):
              simple_test, variants_file = self._setup_simple_test(
                  TEST_WITH_DIFFERENT_AND_SAME_EXPECTED_OUTPUT)
              cmd_line = ('%s run --job-results-dir %s --disable-sysinfo %s '
                          '--test-runner=runner '
      Severity: Major
      Found in selftests/functional/test_output_check.py and 1 other location - About 1 day to fix
      selftests/functional/test_output_check.py on lines 346..359

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 143.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

          def test_disable_output_check(self):
              self._check_output_record_all()
              tampered_msg = b"I PITY THE FOOL THAT STANDS ON MY WAY!"
              stdout_file = "%s.data/stdout.expected" % self.output_script.path
              with open(stdout_file, 'wb') as stdout_file_obj:
      Severity: Major
      Found in selftests/functional/test_output_check.py and 2 other locations - About 1 day to fix
      selftests/functional/test_output_check.py on lines 232..246
      selftests/functional/test_output_check.py on lines 248..262

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 132.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

          def test_output_tamper_combined(self):
              self._check_output_record_combined()
              tampered_msg = b"I PITY THE FOOL THAT STANDS ON MY WAY!"
              output_file = "%s.data/output.expected" % self.output_script.path
              with open(output_file, 'wb') as output_file_obj:
      Severity: Major
      Found in selftests/functional/test_output_check.py and 2 other locations - About 1 day to fix
      selftests/functional/test_output_check.py on lines 232..246
      selftests/functional/test_output_check.py on lines 314..329

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 132.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

          def test_output_tamper_stdout(self):
              self._check_output_record_all()
              tampered_msg = b"I PITY THE FOOL THAT STANDS ON MY WAY!"
              stdout_file = "%s.data/stdout.expected" % self.output_script.path
              with open(stdout_file, 'wb') as stdout_file_obj:
      Severity: Major
      Found in selftests/functional/test_output_check.py and 2 other locations - About 1 day to fix
      selftests/functional/test_output_check.py on lines 248..262
      selftests/functional/test_output_check.py on lines 314..329

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 132.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          def test_output_record_and_check_combined(self):
              self._check_output_record_combined()
              cmd_line = ('%s run --job-results-dir %s --disable-sysinfo %s'
                          ' --test-runner=runner'
                          % (AVOCADO, self.tmpdir.name, self.output_script.path))
      Severity: Major
      Found in selftests/functional/test_output_check.py and 1 other location - About 4 hrs to fix
      selftests/functional/test_output_check.py on lines 210..219

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 80.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          def test_output_record_and_check(self):
              self._check_output_record_all()
              cmd_line = ('%s run --job-results-dir %s --disable-sysinfo %s'
                          ' --test-runner=runner'
                          % (AVOCADO, self.tmpdir.name, self.output_script.path))
      Severity: Major
      Found in selftests/functional/test_output_check.py and 1 other location - About 4 hrs to fix
      selftests/functional/test_output_check.py on lines 221..230

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 80.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              stdout_diff = os.path.join(json_result['tests'][0]['logdir'],
                                         'stdout.diff')
      Severity: Minor
      Found in selftests/functional/test_output_check.py and 1 other location - About 30 mins to fix
      selftests/functional/test_output_check.py on lines 290..291

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 32.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              stderr_diff = os.path.join(json_result['tests'][0]['logdir'],
                                         'stderr.diff')
      Severity: Minor
      Found in selftests/functional/test_output_check.py and 1 other location - About 30 mins to fix
      selftests/functional/test_output_check.py on lines 288..289

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 32.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      There are no issues that match your filters.

      Category
      Status