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

test_method_signatures and test_get_facts tests fail #20

Open
mcepl opened this issue Jan 5, 2023 · 0 comments
Open

test_method_signatures and test_get_facts tests fail #20

mcepl opened this issue Jan 5, 2023 · 0 comments

Comments

@mcepl
Copy link

mcepl commented Jan 5, 2023

Expected Behavior

Test suite passes.

Actual Behavior

[   26s] + export PATH=/home/abuild/rpmbuild/BUILD/napalm-arubaos-switch-0.2.0/build/flavorbin:/usr/local/bin:/usr/bin:/bin
[   26s] + PATH=/home/abuild/rpmbuild/BUILD/napalm-arubaos-switch-0.2.0/build/flavorbin:/usr/local/bin:/usr/bin:/bin
[   26s] ++ '[' -f _current_flavor ']'
[   26s] ++ cat _current_flavor
[   26s] + last_flavor=python310
[   26s] + '[' -z python310 ']'
[   26s] + '[' python310 '!=' python38 ']'
[   26s] + '[' -d build ']'
[   26s] + mv build _build.python310
[   26s] + '[' -d _build.python38 ']'
[   26s] + mv _build.python38 build
[   26s] + echo python38
[   26s] + python_flavor=python38
[   26s] + PYTHONPATH=/home/abuild/rpmbuild/BUILDROOT/python-napalm-arubaos-switch-0.2.0-0.x86_64/usr/lib/python3.8/site-packages
[   26s] + PYTHONDONTWRITEBYTECODE=1
[   26s] + pytest-3.8 --ignore=_build.python38 --ignore=_build.python39 --ignore=_build.python310 -v -v -k 'not (test_traceroute)'
[   27s] ============================= test session starts ==============================
[   27s] platform linux -- Python 3.8.16, pytest-7.1.2, pluggy-1.0.0 -- /usr/bin/python3.8
[   27s] cachedir: .pytest_cache
[   27s] metadata: {'Python': '3.8.16', 'Platform': 'Linux-6.1.1-1-default-x86_64-with-glibc2.34', 'Packages': {'pytest': '7.1.2', 'pluggy': '1.0.0'}, 'Plugins': {'anyio': '3.6.2', 'metadata': '2.0.4', 'json-report': '1.5.0', 'cov': '4.0.0'}}
[   27s] rootdir: /home/abuild/rpmbuild/BUILD/napalm-arubaos-switch-0.2.0, configfile: setup.cfg, testpaths: test
[   27s] plugins: anyio-3.6.2, metadata-2.0.4, json-report-1.5.0, cov-4.0.0
[   28s] collecting ... collected 40 items / 1 deselected / 39 selected

...

[   29s] =================================== FAILURES ===================================
[   29s] ______________________ TestGetter.test_method_signatures _______________________
[   29s] 
[   29s] self = <test.unit.test_getters.TestGetter object at 0x7face23c8490>
[   29s] 
[   29s]     def test_method_signatures(self):
[   29s]         """
[   29s]         Test that all methods have the same signature.
[   29s]     
[   29s]         The type hint annotations are ignored here because the import paths might differ."""
[   29s]         errors = {}
[   29s]         cls = self.driver
[   29s]         # Create fictional driver instance (py3 needs bound methods)
[   29s]         tmp_obj = cls(hostname="test", username="admin", password="pwd")
[   29s]         attrs = [m for m, v in inspect.getmembers(tmp_obj)]
[   29s]         for attr in attrs:
[   29s]             func = getattr(tmp_obj, attr)
[   29s]             if attr.startswith("_") or not inspect.ismethod(func):
[   29s]                 continue
[   29s]             try:
[   29s]                 orig = getattr(NetworkDriver, attr)
[   29s]                 orig_spec = inspect.getfullargspec(orig)[:4]
[   29s]             except AttributeError:
[   29s]                 orig_spec = "Method does not exist in napalm.base"
[   29s]             func_spec = inspect.getfullargspec(func)[:4]
[   29s]             if orig_spec != func_spec:
[   29s]                 errors[attr] = (orig_spec, func_spec)
[   29s]     
[   29s]         EXTRA_METHODS = ["__init__"]
[   29s]         for method in EXTRA_METHODS:
[   29s]             orig_spec = inspect.getfullargspec(getattr(NetworkDriver, method))[:4]
[   29s]             func_spec = inspect.getfullargspec(getattr(cls, method))[:4]
[   29s]             if orig_spec != func_spec:
[   29s]                 errors[attr] = (orig_spec, func_spec)
[   29s]     
[   29s] >       assert not errors, "Some methods vary. \n{}".format(errors.keys())
[   29s] E       AssertionError: Some methods vary. 
[   29s] E       dict_keys(['cli'])
[   29s] 
[   29s] /usr/lib/python3.8/site-packages/napalm/base/test/getters.py:141: AssertionError
[   29s] ______________________ TestGetter.test_get_facts[normal] _______________________
[   29s] 
[   29s] self = <test.unit.test_getters.TestGetter object at 0x7face23bd5e0>
[   29s] test_case = 'normal'
[   29s] 
[   29s]     @wrap_test_cases
[   29s]     def test_get_facts(self, test_case):
[   29s]         """Test get_facts method."""
[   29s]         facts = self.device.get_facts()
[   29s] >       assert helpers.test_model(models.FactsDict, facts)
[   29s] E       AssertionError
[   29s] 
[   29s] /usr/lib/python3.8/site-packages/napalm/base/test/getters.py:154: AssertionError
[   29s] _______________________ TestGetter.test_get_facts[stack] _______________________
[   29s] 
[   29s] self = <test.unit.test_getters.TestGetter object at 0x7face23bdd30>
[   29s] test_case = 'stack'
[   29s] 
[   29s]     @wrap_test_cases
[   29s]     def test_get_facts(self, test_case):
[   29s]         """Test get_facts method."""
[   29s]         facts = self.device.get_facts()
[   29s] >       assert helpers.test_model(models.FactsDict, facts)
[   29s] E       AssertionError
[   29s] 
[   29s] /usr/lib/python3.8/site-packages/napalm/base/test/getters.py:154: AssertionError
[   29s] =============================== warnings summary ===============================
[   29s] ../../../../../usr/lib/python3.8/site-packages/_pytest/config/__init__.py:1252
[   29s]   /usr/lib/python3.8/site-packages/_pytest/config/__init__.py:1252: PytestConfigWarning: Unknown config option: json_report
[   29s]   
[   29s]     self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
[   29s] 
[   29s] ../../../../../usr/lib/python3.8/site-packages/_pytest/config/__init__.py:1252
[   29s]   /usr/lib/python3.8/site-packages/_pytest/config/__init__.py:1252: PytestConfigWarning: Unknown config option: jsonapi
[   29s]   
[   29s]     self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
[   29s] 
[   29s] -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
[   29s] 
[   29s] ---------- coverage: platform linux, python 3.8.16-final-0 -----------
[   29s] Name                                                  Stmts   Miss  Cover   Missing
[   29s] -----------------------------------------------------------------------------------
[   29s] napalm_arubaoss/ArubaOS.py                              141     31    78%   71-72, 75, 94-96, 116-118, 126-128, 138, 147, 155, 163-166, 504, 512-514, 529-533, 551-555, 569, 577-585, 620, 628, 636-638, 651-653
[   29s] napalm_arubaoss/__init__.py                               2      0   100%
[   29s] napalm_arubaoss/helper/__init__.py                       24      0   100%
[   29s] napalm_arubaoss/helper/base.py                           97     68    30%   50-101, 105-114, 124-126, 136-138, 148-150, 160-162, 171-192, 205-227, 236-237
[   29s] napalm_arubaoss/helper/commit_config.py                  27     19    30%   26-60
[   29s] napalm_arubaoss/helper/compare_config.py                 22     17    23%   19-52
[   29s] napalm_arubaoss/helper/confirm_commit.py                 10      4    60%   19-23
[   29s] napalm_arubaoss/helper/get_arp_table.py                  16      0   100%
[   29s] napalm_arubaoss/helper/get_config.py                     13      2    85%   19-21
[   29s] napalm_arubaoss/helper/get_facts.py                      37      0   100%
[   29s] napalm_arubaoss/helper/get_interfaces.py                 43      5    88%   28-29, 32-33, 56
[   29s] napalm_arubaoss/helper/get_interfaces_ip.py              22      0   100%
[   29s] napalm_arubaoss/helper/get_lldp_neighbors.py             15      0   100%
[   29s] napalm_arubaoss/helper/get_lldp_neighbors_detail.py      15      0   100%
[   29s] napalm_arubaoss/helper/get_mac_address_table.py          12      0   100%
[   29s] napalm_arubaoss/helper/get_ntp_servers.py                16      0   100%
[   29s] napalm_arubaoss/helper/get_ntp_stats.py                  33      9    73%   29-38, 58, 74
[   29s] napalm_arubaoss/helper/get_route_to.py                   33      6    82%   68-83, 103
[   29s] napalm_arubaoss/helper/has_pending_commit.py              9      5    44%   18-24
[   29s] napalm_arubaoss/helper/is_alive.py                        9      5    44%   16-22
[   29s] napalm_arubaoss/helper/load_merge_candidate.py           13      8    38%   25-36
[   29s] napalm_arubaoss/helper/load_replace_candidate.py         14      9    36%   28-37
[   29s] napalm_arubaoss/helper/ping.py                           15      1    93%   25
[   29s] napalm_arubaoss/helper/rollback.py                       11      6    45%   18-25
[   29s] napalm_arubaoss/helper/traceroute.py                     23     19    17%   17-55
[   29s] napalm_arubaoss/helper/utils.py                          61     46    25%   19-20, 30-32, 43-62, 79-101, 112-122, 133-140
[   29s] -----------------------------------------------------------------------------------
[   29s] TOTAL                                                   733    260    65%
[   29s] 
[   29s] =========================== short test summary info ============================
[   29s] FAILED test/unit/test_getters.py::TestGetter::test_method_signatures - Assert...
[   29s] FAILED test/unit/test_getters.py::TestGetter::test_get_facts[normal] - Assert...
[   29s] FAILED test/unit/test_getters.py::TestGetter::test_get_facts[stack] - Asserti...
[   29s] ====== 3 failed, 21 passed, 15 skipped, 1 deselected, 2 warnings in 1.88s ======

Complete build log with all details of packages used and steps taken.

Specifications

  • Version: 0.2.0 (tarball from GitHub)
  • Platform: Linux/openSUSE/Factory (current development version of openSUSE)
  • Subsystem: ???
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this issue Jan 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant