WeblateOrg/wlc

Test seems broken

ktrace opened this issue · 7 comments

Describe the issue

Traceback (most recent call last):
File "XXX/wlc-1.13/wlc/test_main.py", line 31, in
from .test_base import APITest
ImportError: attempted relative import with no known parent package

Traceback (most recent call last):
File "XXX/wlc-1.13/wlc/test_wlc.py", line 37, in
from .test_base import APITest
ImportError: attempted relative import with no known parent package

I already tried

  • I've read and searched the documentation.
  • I've searched for similar issues in this repository.

Steps to reproduce the behavior

  1. Run test
  2. See first error
  3. Replace "from .test_base import APITest" to "from wlc.test_base import APITest" in test_main.py
  4. Run test again
  5. See second error

Expected behavior

No response

Screenshots

No response

Exception traceback

No response

Additional context

No response

nijel commented

How do you run the tests? It works just fine in both our development environment and CI.

python3.10 wlc/test_main.py
python3.10 wlc/test_base.py
python3.10 wlc/test_wlc.py

nijel commented

Use pytest to execute them.

platform linux -- Python 3.10.6, pytest-7.1.2, pluggy-1.0.0 -- /usr/bin/python3.10
cachedir: .pytest_cache
rootdir: /var/tmp/portage/app-i18n/weblate-cli-1.13/work/wlc-1.13
collecting ... collected 129 items

wlc/test_main.py::TestSettings::test_argv PASSED                                                                                                                                                            [  0%]
wlc/test_main.py::TestSettings::test_commandline PASSED                                                                                                                                                     [  1%]
wlc/test_main.py::TestSettings::test_config PASSED                                                                                                                                                          [  2%]
wlc/test_main.py::TestSettings::test_config_appdata PASSED                                                                                                                                                  [  3%]
wlc/test_main.py::TestSettings::test_config_cwd PASSED                                                                                                                                                      [  3%]
wlc/test_main.py::TestSettings::test_config_key PASSED                                                                                                                                                      [  4%]
wlc/test_main.py::TestSettings::test_config_section PASSED                                                                                                                                                  [  5%]
wlc/test_main.py::TestSettings::test_debug PASSED                                                                                                                                                           [  6%]
wlc/test_main.py::TestSettings::test_default_config_values PASSED                                                                                                                                           [  6%]
wlc/test_main.py::TestSettings::test_get_request_options PASSED                                                                                                                                             [  7%]
wlc/test_main.py::TestSettings::test_parsing PASSED                                                                                                                                                         [  8%]
wlc/test_main.py::TestSettings::test_settings PASSED                                                                                                                                                        [  9%]
wlc/test_main.py::TestSettings::test_stdout PASSED                                                                                                                                                          [ 10%]
wlc/test_main.py::TestOutput::test_json_encoder PASSED                                                                                                                                                      [ 10%]
wlc/test_main.py::TestOutput::test_projects_csv PASSED                                                                                                                                                      [ 11%]
wlc/test_main.py::TestOutput::test_projects_html PASSED                                                                                                                                                     [ 12%]
wlc/test_main.py::TestOutput::test_projects_json PASSED                                                                                                                                                     [ 13%]
wlc/test_main.py::TestOutput::test_projects_text PASSED                                                                                                                                                     [ 13%]
wlc/test_main.py::TestOutput::test_version_csv PASSED                                                                                                                                                       [ 14%]
wlc/test_main.py::TestOutput::test_version_html PASSED                                                                                                                                                      [ 15%]
wlc/test_main.py::TestOutput::test_version_json PASSED                                                                                                                                                      [ 16%]
wlc/test_main.py::TestOutput::test_version_text PASSED                                                                                                                                                      [ 17%]
wlc/test_main.py::TestCommands::test_changes PASSED                                                                                                                                                         [ 17%]
wlc/test_main.py::TestCommands::test_cleanup PASSED                                                                                                                                                         [ 18%]
wlc/test_main.py::TestCommands::test_commit PASSED                                                                                                                                                          [ 19%]
wlc/test_main.py::TestCommands::test_delete PASSED                                                                                                                                                          [ 20%]
wlc/test_main.py::TestCommands::test_download PASSED                                                                                                                                                        [ 20%]
wlc/test_main.py::TestCommands::test_list_components PASSED                                                                                                                                                 [ 21%]
wlc/test_main.py::TestCommands::test_list_languages PASSED                                                                                                                                                  [ 22%]
wlc/test_main.py::TestCommands::test_list_projects PASSED                                                                                                                                                   [ 23%]
wlc/test_main.py::TestCommands::test_list_translations PASSED                                                                                                                                               [ 24%]
wlc/test_main.py::TestCommands::test_locks PASSED                                                                                                                                                           [ 24%]
wlc/test_main.py::TestCommands::test_ls PASSED                                                                                                                                                              [ 25%]
wlc/test_main.py::TestCommands::test_pull PASSED                                                                                                                                                            [ 26%]
wlc/test_main.py::TestCommands::test_push PASSED                                                                                                                                                            [ 27%]
wlc/test_main.py::TestCommands::test_repo PASSED                                                                                                                                                            [ 27%]
wlc/test_main.py::TestCommands::test_reset PASSED                                                                                                                                                           [ 28%]
wlc/test_main.py::TestCommands::test_show PASSED                                                                                                                                                            [ 29%]
wlc/test_main.py::TestCommands::test_show_error PASSED                                                                                                                                                      [ 30%]
wlc/test_main.py::TestCommands::test_stats PASSED                                                                                                                                                           [ 31%]
wlc/test_main.py::TestCommands::test_upload PASSED                                                                                                                                                          [ 31%]
wlc/test_main.py::TestCommands::test_version_bare PASSED                                                                                                                                                    [ 32%]
wlc/test_main.py::TestErrors::test_commandline_missing_key PASSED                                                                                                                                           [ 33%]
wlc/test_main.py::TestErrors::test_commandline_wrong_key PASSED                                                                                                                                             [ 34%]
wlc/test_wlc.py::WeblateErrorTest::test_bug PASSED                                                                                                                                                          [ 34%]
wlc/test_wlc.py::WeblateErrorTest::test_denied PASSED                                                                                                                                                       [ 35%]
wlc/test_wlc.py::WeblateErrorTest::test_denied_json PASSED                                                                                                                                                  [ 36%]
wlc/test_wlc.py::WeblateErrorTest::test_error PASSED                                                                                                                                                        [ 37%]
wlc/test_wlc.py::WeblateErrorTest::test_invalid PASSED                                                                                                                                                      [ 37%]
wlc/test_wlc.py::WeblateErrorTest::test_invalid_attribute PASSED                                                                                                                                            [ 38%]
wlc/test_wlc.py::WeblateErrorTest::test_nonexisting PASSED                                                                                                                                                  [ 39%]
wlc/test_wlc.py::WeblateErrorTest::test_oserror PASSED                                                                                                                                                      [ 40%]
wlc/test_wlc.py::WeblateErrorTest::test_throttled PASSED                                                                                                                                                    [ 41%]
wlc/test_wlc.py::WeblateErrorTest::test_too_long PASSED                                                                                                                                                     [ 41%]
wlc/test_wlc.py::WeblateTest::test_add_source_string_to_monolingual_component PASSED                                                                                                                        [ 42%]
wlc/test_wlc.py::WeblateTest::test_api_trailing_slash PASSED                                                                                                                                                [ 43%]
wlc/test_wlc.py::WeblateTest::test_authentication PASSED                                                                                                                                                    [ 44%]
wlc/test_wlc.py::WeblateTest::test_components PASSED                                                                                                                                                        [ 44%]
wlc/test_wlc.py::WeblateTest::test_create_component PASSED                                                                                                                                                  [ 45%]
wlc/test_wlc.py::WeblateTest::test_create_component_local_files PASSED                                                                                                                                      [ 46%]
wlc/test_wlc.py::WeblateTest::test_create_language PASSED                                                                                                                                                   [ 47%]
wlc/test_wlc.py::WeblateTest::test_create_project PASSED                                                                                                                                                    [ 48%]
wlc/test_wlc.py::WeblateTest::test_ensure_loaded PASSED                                                                                                                                                     [ 48%]
wlc/test_wlc.py::WeblateTest::test_languages PASSED                                                                                                                                                         [ 49%]
wlc/test_wlc.py::WeblateTest::test_projects PASSED                                                                                                                                                          [ 50%]
wlc/test_wlc.py::WeblateTest::test_repr PASSED                                                                                                                                                              [ 51%]
wlc/test_wlc.py::WeblateTest::test_setattrvalue PASSED                                                                                                                                                      [ 51%]
wlc/test_wlc.py::WeblateTest::test_translations PASSED                                                                                                                                                      [ 52%]
wlc/test_wlc.py::ProjectTest::test_changes PASSED                                                                                                                                                           [ 53%]
wlc/test_wlc.py::ProjectTest::test_cleanup PASSED                                                                                                                                                           [ 54%]
wlc/test_wlc.py::ProjectTest::test_commit PASSED                                                                                                                                                            [ 55%]
wlc/test_wlc.py::ProjectTest::test_create_component PASSED                                                                                                                                                  [ 55%]
wlc/test_wlc.py::ProjectTest::test_data PASSED                                                                                                                                                              [ 56%]
wlc/test_wlc.py::ProjectTest::test_delete PASSED                                                                                                                                                            [ 57%]
wlc/test_wlc.py::ProjectTest::test_get PASSED                                                                                                                                                               [ 58%]
wlc/test_wlc.py::ProjectTest::test_languages PASSED                                                                                                                                                         [ 58%]
wlc/test_wlc.py::ProjectTest::test_list PASSED                                                                                                                                                              [ 59%]
wlc/test_wlc.py::ProjectTest::test_pull PASSED                                                                                                                                                              [ 60%]
wlc/test_wlc.py::ProjectTest::test_push PASSED                                                                                                                                                              [ 61%]
wlc/test_wlc.py::ProjectTest::test_refresh PASSED                                                                                                                                                           [ 62%]
wlc/test_wlc.py::ProjectTest::test_repository PASSED                                                                                                                                                        [ 62%]
wlc/test_wlc.py::ProjectTest::test_repository_commit PASSED                                                                                                                                                 [ 63%]
wlc/test_wlc.py::ProjectTest::test_reset PASSED                                                                                                                                                             [ 64%]
wlc/test_wlc.py::ProjectTest::test_statistics PASSED                                                                                                                                                        [ 65%]
wlc/test_wlc.py::ComponentTest::test_add_translation PASSED                                                                                                                                                 [ 65%]
wlc/test_wlc.py::ComponentTest::test_changes PASSED                                                                                                                                                         [ 66%]
wlc/test_wlc.py::ComponentTest::test_cleanup PASSED                                                                                                                                                         [ 67%]
wlc/test_wlc.py::ComponentTest::test_commit PASSED                                                                                                                                                          [ 68%]
wlc/test_wlc.py::ComponentTest::test_data PASSED                                                                                                                                                            [ 68%]
wlc/test_wlc.py::ComponentTest::test_delete PASSED                                                                                                                                                          [ 69%]
wlc/test_wlc.py::ComponentTest::test_get PASSED                                                                                                                                                             [ 70%]
wlc/test_wlc.py::ComponentTest::test_keys PASSED                                                                                                                                                            [ 71%]
wlc/test_wlc.py::ComponentTest::test_list PASSED                                                                                                                                                            [ 72%]
wlc/test_wlc.py::ComponentTest::test_lock PASSED                                                                                                                                                            [ 72%]
wlc/test_wlc.py::ComponentTest::test_lock_status PASSED                                                                                                                                                     [ 73%]
wlc/test_wlc.py::ComponentTest::test_pull PASSED                                                                                                                                                            [ 74%]
wlc/test_wlc.py::ComponentTest::test_push PASSED                                                                                                                                                            [ 75%]
wlc/test_wlc.py::ComponentTest::test_refresh PASSED                                                                                                                                                         [ 75%]
wlc/test_wlc.py::ComponentTest::test_repository PASSED                                                                                                                                                      [ 76%]
wlc/test_wlc.py::ComponentTest::test_repository_commit PASSED                                                                                                                                               [ 77%]
wlc/test_wlc.py::ComponentTest::test_reset PASSED                                                                                                                                                           [ 78%]
wlc/test_wlc.py::ComponentTest::test_statistics PASSED                                                                                                                                                      [ 79%]
wlc/test_wlc.py::ComponentTest::test_unlock PASSED                                                                                                                                                          [ 79%]
wlc/test_wlc.py::TranslationTest::test_changes PASSED                                                                                                                                                       [ 80%]
wlc/test_wlc.py::TranslationTest::test_cleanup PASSED                                                                                                                                                       [ 81%]
wlc/test_wlc.py::TranslationTest::test_commit PASSED                                                                                                                                                        [ 82%]
wlc/test_wlc.py::TranslationTest::test_data PASSED                                                                                                                                                          [ 82%]
wlc/test_wlc.py::TranslationTest::test_delete PASSED                                                                                                                                                        [ 83%]
wlc/test_wlc.py::TranslationTest::test_download PASSED                                                                                                                                                      [ 84%]
wlc/test_wlc.py::TranslationTest::test_download_csv PASSED                                                                                                                                                  [ 85%]
wlc/test_wlc.py::TranslationTest::test_get PASSED                                                                                                                                                           [ 86%]
wlc/test_wlc.py::TranslationTest::test_list PASSED                                                                                                                                                          [ 86%]
wlc/test_wlc.py::TranslationTest::test_pull PASSED                                                                                                                                                          [ 87%]
wlc/test_wlc.py::TranslationTest::test_push PASSED                                                                                                                                                          [ 88%]
wlc/test_wlc.py::TranslationTest::test_refresh PASSED                                                                                                                                                       [ 89%]
wlc/test_wlc.py::TranslationTest::test_repository PASSED                                                                                                                                                    [ 89%]
wlc/test_wlc.py::TranslationTest::test_repository_commit PASSED                                                                                                                                             [ 90%]
wlc/test_wlc.py::TranslationTest::test_reset PASSED                                                                                                                                                         [ 91%]
wlc/test_wlc.py::TranslationTest::test_statistics PASSED                                                                                                                                                    [ 92%]
wlc/test_wlc.py::TranslationTest::test_units PASSED                                                                                                                                                         [ 93%]
wlc/test_wlc.py::TranslationTest::test_units_search PASSED                                                                                                                                                  [ 93%]
wlc/test_wlc.py::TranslationTest::test_upload PASSED                                                                                                                                                        [ 94%]
wlc/test_wlc.py::TranslationTest::test_upload_format PASSED                                                                                                                                                 [ 95%]
wlc/test_wlc.py::TranslationTest::test_upload_method PASSED                                                                                                                                                 [ 96%]
wlc/test_wlc.py::UnitTest::test_get PASSED                                                                                                                                                                  [ 96%]
wlc/test_wlc.py::UnitTest::test_list PASSED                                                                                                                                                                 [ 97%]
wlc/test_wlc.py::UnitTest::test_units_delete PASSED                                                                                                                                                         [ 98%]
wlc/test_wlc.py::UnitTest::test_units_patch PASSED                                                                                                                                                          [ 99%]
wlc/test_wlc.py::UnitTest::test_units_put PASSED                                                                                                                                                            [100%]

=============================================================================================== 129 passed in 3.25s ===============================================================================================

Is it OK? I don't see test_base

nijel commented

That's correct, it defines only base classes for tests, but does not implement any tests.

OK, it was issue to me. Sorry for noice.

The issue you have reported is now resolved. If you don’t feel it’s right, please follow its labels to get a clue for further steps.

  • In case you see a similar problem, please open a separate issue.
  • If you are happy with the outcome, don’t hesitate to support Weblate by making a donation.