Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken unit test #15

Open
nodeg opened this issue Jul 26, 2022 · 1 comment
Open

Fix broken unit test #15

nodeg opened this issue Jul 26, 2022 · 1 comment
Labels
test Test related issues

Comments

@nodeg
Copy link
Member

nodeg commented Jul 26, 2022

Python 3.11.7 was used.

pip install pytest
(...)
pip install -r requirements.txt
(...)

python3 -m unittest
......VAR=555
..Removing tags and fetching from <MagicMock name='Repository().remotes.__getitem__().url' id='4568892752'>...
mytag seems to be a tag
Checking out
Removing tags and fetching from <MagicMock name='Repository().remotes.__getitem__().url' id='4568892752'>...
Checking out
Performing hard reset to ignore local changes
uRemoving tags and fetching from <MagicMock name='Repository().remotes.__getitem__().url' id='4535519568'>...
Checking out
Performing hard reset to ignore local changes
u..umytag seems to be a tag
mytag seems to be a tag
Checking out
Checking out
Performing hard reset to ignore local changes
.Removing tags and fetching from <MagicMock name='Repository().remotes.__getitem__().url' id='4568705552'>...
mytag seems to be a tag
Checking out
...u...........
======================================================================
UNEXPECTED SUCCESS: test_clone_ref_is_tag (test.test_git.TestGit.test_clone_ref_is_tag)
UNEXPECTED SUCCESS: test_create_remote_from_url (test.test_git.TestGit.test_create_remote_from_url)
UNEXPECTED SUCCESS: test_is_remote (test.test_git.TestGit.test_is_remote)
UNEXPECTED SUCCESS: test_sort_test_files_by_mtime (test.test_junit.TestJunit.test_sort_test_files_by_mtime)
----------------------------------------------------------------------
Ran 29 tests in 0.327s

FAILED (unexpected successes=4)
TEST⏎ 
@nodeg nodeg added the test Test related issues label Jul 26, 2022
@nodeg
Copy link
Member Author

nodeg commented Feb 2, 2024

The current CI tests fail with:

============================= test session starts ==============================
platform linux -- Python 3.11.7, pytest-8.0.0, pluggy-1.4.0
rootdir: /home/runner/work/terracumber/terracumber
plugins: cov-4.1.0
collected 29 items

test/test_config.py .                                                    [  3%]
test/test_cucumber.py ......                                             [ 24%]
test/test_git.py .xx..x..                                                [ 51%]
test/test_junit.py .Fx.                                                  [ 65%]
test/test_mailer.py .                                                    [ 68%]
test/test_terraformer.py .......                                         [ 93%]
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/coverage/inorout.py:503: CoverageWarning: Module com was never imported. (module-not-imported)
  self.warn(f"Module {pkg} was never imported.", slug="module-not-imported")
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/coverage/control.py:887: CoverageWarning: No data was collected. (no-data-collected)
  self._warn("No data was collected.", slug="no-data-collected")
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/pytest_cov/plugin.py:312: CovReportWarning: Failed to generate report: No data to report.

  warnings.warn(CovReportWarning(message))
test/test_utils.py ..                                                    [100%]WARNING: Failed to generate report: No data to report.



=================================== FAILURES ===================================
__________________________ TestJunit.test_get_totals ___________________________

self = <test.test_junit.TestJunit testMethod=test_get_totals>

    def test_get_totals(self):
        totals = {'failures': 3, 'errors': 0, 'skipped': 0, 'passed': 63, 'tests': 66, 'time': 1334.586592}
>       self.assertDictEqual(self.junit.get_totals(), totals)
E       AssertionError: {'fai[29 chars]ped': 0, 'passed': 63, 'tests': 66, 'time': 1334.5865919999999} != {'fai[29 chars]ped': 0, 'passed': 63, 'tests': 66, 'time': 1334.586592}
E         {'errors': 0,
E          'failures': 3,
E          'passed': 63,
E          'skipped': 0,
E          'tests': 66,
E       -  'time': 1334.5865919999999}
E       ?                    ^^^^^^^^
E       
E       +  'time': 1334.586592}
E       ?                    ^

test/test_junit.py:24: AssertionError
=============================== warnings summary ===============================
terracumber/git.py:86
  /home/runner/work/terracumber/terracumber/terracumber/git.py:86: DeprecationWarning: invalid escape sequence '\/'
    if re.match('refs\/tags\/.+', reference):

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
- generated xml file: /home/runner/work/terracumber/terracumber/junit/test-results.xml -

---------- coverage: platform linux, python 3.11.7-final-0 -----------

=========================== short test summary info ============================
FAILED test/test_junit.py::TestJunit::test_get_totals - AssertionError: {'fai[29 chars]ped': 0, 'passed': 63, 'tests': 66, 'time': 1334.5865919999999} != {'fai[29 chars]ped': 0, 'passed': 63, 'tests': 66, 'time': 1334.586592}
  {'errors': 0,
   'failures': 3,
   'passed': 63,
   'skipped': 0,
   'tests': 66,
-  'time': 1334.5865919999999}
?                    ^^^^^^^^

+  'time': 1334.586592}
?                    ^
============== 1 failed, 24 passed, 4 xfailed, 1 warning in 1.[51](https://github.com/uyuni-project/terracumber/pull/30/checks#step:5:52)s ==============

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Test related issues
Projects
None yet
Development

No branches or pull requests

1 participant