Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-35876

Install Packages for the Unit Tests with PySide2

    XMLWordPrintable

Details

    • Story
    • Status: Done
    • Resolution: Done
    • None
    • ts_main_telescope

    Description

      Please help to install the packages (xorg-x11-server-Xvfb and pytest-xvfb) in the docker image of lsstts/develop-env:develop. By doing this, the unit tests with PySide2 can be executed without prompting the windows, which is important when using the Jenkins to do the CI job. The former can use the dnf to install and the latter can be installed by conda -c conda-forge.

      The installation can be tested by ts_m2gui. Assume the host machine is using the CentOS, you can do the following to enter the container:

      docker run -it --rm -v ${path_to_ts_m2gui}:${path_of_package_in_container} ${docker_image}:${image_tag}
      

      Note that you SHOULD NOT use the image forward to enter the container, which simulates the condition to run the CI on Jenkins instance. To setup this package (ts_m2gui), you can do setup -kr ${path_of_package} if the eups is used. Or you can export the PYTHONPATH directly for ts_m2gui/python.

      After this, if you do pytest tests/ under ts_m2gui directory, you should see all tests pass without prompting any window as the following:

      [saluser@ba2452d2ef09 ts_m2gui]$ pytest tests/
      ============================= test session starts ==============================
      platform linux -- Python 3.10.5, pytest-7.1.2, pluggy-1.0.0
      PySide2 5.13.2 -- Qt runtime 5.12.9 -- Qt compiled 5.12.9
      rootdir: /home/saluser/ts_m2gui, configfile: setup.cfg
      plugins: cov-3.0.0, remotedata-0.3.3, astropy-header-0.1.2, openfiles-0.5.0, forked-1.4.0, session2file-0.1.11, hypothesis-6.47.1, mock-3.8.2, subtests-0.8.0, doctestplus-0.12.0, arraydiff-0.3, xdist-2.5.0, asdf-2.10.1, astropy-0.10.0, flake8-1.1.1, filter-subpackage-0.1.1, xvfb-2.0.0, qt-4.1.0, anyio-3.6.1, asyncio-0.18.3, black-0.3.12, tornasync-0.6.0.post2, mypy-0.8.0
      asyncio: mode=legacy
      collected 172 items                                                            
       
      tests/test_control_tabs.py s.....                                        [  3%]
      tests/test_fault_manager.py .............                                [ 11%]
      tests/test_main_window.py s..                                            [ 12%]
      tests/test_model.py .......................                              [ 26%]
      tests/test_utility_monitor.py ....................                       [ 37%]
      tests/test_utils.py ......                                               [ 41%]
      tests/controltab/test_tab_actuator_control.py s...........               [ 48%]
      tests/controltab/test_tab_alarm_warn.py s.......                         [ 52%]
      tests/controltab/test_tab_cell_status.py s....                           [ 55%]
      tests/controltab/test_tab_config_view.py s.                              [ 56%]
      tests/controltab/test_tab_default.py s..                                 [ 58%]
      tests/controltab/test_tab_detailed_force.py s..                          [ 60%]
      tests/controltab/test_tab_diagnostics.py s........                       [ 65%]
      tests/controltab/test_tab_overview.py s......                            [ 69%]
      tests/controltab/test_tab_rigid_body_pos.py s....                        [ 72%]
      tests/controltab/test_tab_settings.py s..                                [ 74%]
      tests/controltab/test_tab_utility_view.py s.......                       [ 79%]
      tests/display/test_figure_constant_realtime.py s...                      [ 81%]
      tests/display/test_figure_constant_static.py s.........                  [ 87%]
      tests/display/test_gauge.py s....                                        [ 90%]
      tests/display/test_view_mirror.py s....                                  [ 93%]
      tests/layout/test_layout_control.py s...                                 [ 95%]
      tests/layout/test_layout_control_mode.py s...                            [ 97%]
      tests/layout/test_layout_local_mode.py s...                              [100%]
       
      =============================== warnings summary ===============================
      ../../../opt/lsst/software/stack/conda/envs/lsst-scipipe-4.1.0/lib/python3.10/site-packages/pytest_asyncio/plugin.py:191
        /opt/lsst/software/stack/conda/envs/lsst-scipipe-4.1.0/lib/python3.10/site-packages/pytest_asyncio/plugin.py:191: DeprecationWarning: The 'asyncio_mode' default value will change to 'strict' in future, please explicitly use 'asyncio_mode=strict' or 'asyncio_mode=auto' in pytest configuration file.
          config.issue_config_time_warning(LEGACY_MODE, stacklevel=2)
       
      tests/test_fault_manager.py::flake-8::FLAKE8
      tests/test_fault_manager.py::flake-8::FLAKE8
      tests/test_model.py::flake-8::FLAKE8
      tests/test_model.py::flake-8::FLAKE8
      tests/test_utility_monitor.py::flake-8::FLAKE8
      tests/test_utility_monitor.py::flake-8::FLAKE8
      tests/test_utils.py::flake-8::FLAKE8
      tests/test_utils.py::flake-8::FLAKE8
        /opt/lsst/software/stack/conda/envs/lsst-scipipe-4.1.0/lib/python3.10/site-packages/flake8/plugins/manager.py:261: DeprecationWarning: SelectableGroups dict interface is deprecated. Use select.
          eps = importlib_metadata.entry_points().get(self.namespace, ())
       
      ../../../opt/lsst/software/stack/conda/envs/lsst-scipipe-4.1.0/lib/python3.10/site-packages/_pytest/cacheprovider.py:433
        /opt/lsst/software/stack/conda/envs/lsst-scipipe-4.1.0/lib/python3.10/site-packages/_pytest/cacheprovider.py:433: PytestCacheWarning: cache could not write path /home/saluser/ts_m2gui/.pytest_cache/v/cache/nodeids
          config.cache.set("cache/nodeids", sorted(self.cached_nodeids))
       
      ../../../opt/lsst/software/stack/conda/envs/lsst-scipipe-4.1.0/lib/python3.10/site-packages/_pytest/stepwise.py:52
        /opt/lsst/software/stack/conda/envs/lsst-scipipe-4.1.0/lib/python3.10/site-packages/_pytest/stepwise.py:52: PytestCacheWarning: cache could not write path /home/saluser/ts_m2gui/.pytest_cache/v/cache/stepwise
          session.config.cache.set(STEPWISE_CACHE_DIR, [])
       
      -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
      ================ 152 passed, 20 skipped, 11 warnings in 15.90s =================
      /opt/lsst/software/stack/conda/envs/lsst-scipipe-4.1.0/lib/python3.10/site-packages/pytest_flake8.py:84: PytestCacheWarning: cache could not write path /home/saluser/ts_m2gui/.pytest_cache/v/flake8/mtimes
        config.cache.set(HISTKEY, config._flake8mtimes)
      

      Attachments

        Issue Links

          Activity

            This ticket is also used for other ts_cycle_build and ts_recipes updates.

            wvreeven Wouter van Reeven added a comment - This ticket is also used for other ts_cycle_build and ts_recipes updates.
            wvreeven Wouter van Reeven added a comment - ts_recipes PR: https://github.com/lsst-ts/ts_recipes/pull/35
            wvreeven Wouter van Reeven added a comment - - edited

            With the OS package and conda package added to the Docker image, the builds pass:

            [saluser@cbef074781db ts_m2gui]$ pytest tests
            ================================ test session starts ================================
            platform linux -- Python 3.10.5, pytest-7.1.2, pluggy-1.0.0
            PySide2 5.13.2 -- Qt runtime 5.12.9 -- Qt compiled 5.12.9
            rootdir: /home/saluser/dev/ts_m2gui, configfile: setup.cfg
            plugins: openfiles-0.5.0, arraydiff-0.3, remotedata-0.3.3, astropy-header-0.1.2, subtests-0.8.0, forked-1.4.0, hypothesis-6.47.1, flake8-1.1.1, mock-3.8.2, cov-3.0.0, doctestplus-0.12.0, filter-subpackage-0.1.1, astropy-0.10.0, xdist-2.5.0, asdf-2.10.1, session2file-0.1.11, xvfb-2.0.0, qt-4.1.0, anyio-3.6.1, mypy-0.8.0, asyncio-0.18.3, tornasync-0.6.0.post2, black-0.3.12
            asyncio: mode=legacy
            collected 172 itemstests/test_control_tabs.py s.....                                             [  3%]
            tests/test_fault_manager.py s............                                     [ 11%]
            tests/test_main_window.py s..                                                 [ 12%]
            tests/test_model.py s......................                                   [ 26%]
            tests/test_utility_monitor.py s...................                            [ 37%]
            tests/test_utils.py s.....                                                    [ 41%]
            tests/controltab/test_tab_actuator_control.py s...........                    [ 48%]
            tests/controltab/test_tab_alarm_warn.py s.......                              [ 52%]
            tests/controltab/test_tab_cell_status.py s....                                [ 55%]
            tests/controltab/test_tab_config_view.py s.                                   [ 56%]
            tests/controltab/test_tab_default.py s..                                      [ 58%]
            tests/controltab/test_tab_detailed_force.py s..                               [ 60%]
            tests/controltab/test_tab_diagnostics.py s........                            [ 65%]
            tests/controltab/test_tab_overview.py s......                                 [ 69%]
            tests/controltab/test_tab_rigid_body_pos.py s....                             [ 72%]
            tests/controltab/test_tab_settings.py s..                                     [ 74%]
            tests/controltab/test_tab_utility_view.py s.......                            [ 79%]
            tests/display/test_figure_constant_realtime.py s...                           [ 81%]
            tests/display/test_figure_constant_static.py s.........                       [ 87%]
            tests/display/test_gauge.py s....                                             [ 90%]
            tests/display/test_view_mirror.py s....                                       [ 93%]
            tests/layout/test_layout_control.py s...                                      [ 95%]
            tests/layout/test_layout_control_mode.py s...                                 [ 97%]
            tests/layout/test_layout_local_mode.py s...                                   [100%]================================= warnings summary ==================================
            ../../../../opt/lsst/software/stack/conda/envs/lsst-scipipe-4.1.0/lib/python3.10/site-packages/pytest_asyncio/plugin.py:191
              /opt/lsst/software/stack/conda/envs/lsst-scipipe-4.1.0/lib/python3.10/site-packages/pytest_asyncio/plugin.py:191: DeprecationWarning: The 'asyncio_mode' default value will change to 'strict' in future, please explicitly use 'asyncio_mode=strict' or 'asyncio_mode=auto' in pytest configuration file.
                config.issue_config_time_warning(LEGACY_MODE, stacklevel=2)-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
            ==================== 148 passed, 24 skipped, 1 warning in 15.37s ====================
            [saluser@cbef074781db ts_m2gui]$
            

            wvreeven Wouter van Reeven added a comment - - edited With the OS package and conda package added to the Docker image, the builds pass: [saluser @cbef074781db ts_m2gui]$ pytest tests ================================ test session starts ================================ platform linux -- Python 3.10 . 5 , pytest- 7.1 . 2 , pluggy- 1.0 . 0 PySide2 5.13 . 2 -- Qt runtime 5.12 . 9 -- Qt compiled 5.12 . 9 rootdir: /home/saluser/dev/ts_m2gui, configfile: setup.cfg plugins: openfiles- 0.5 . 0 , arraydiff- 0.3 , remotedata- 0.3 . 3 , astropy-header- 0.1 . 2 , subtests- 0.8 . 0 , forked- 1.4 . 0 , hypothesis- 6.47 . 1 , flake8- 1.1 . 1 , mock- 3.8 . 2 , cov- 3.0 . 0 , doctestplus- 0.12 . 0 , filter-subpackage- 0.1 . 1 , astropy- 0.10 . 0 , xdist- 2.5 . 0 , asdf- 2.10 . 1 , session2file- 0.1 . 11 , xvfb- 2.0 . 0 , qt- 4.1 . 0 , anyio- 3.6 . 1 , mypy- 0.8 . 0 , asyncio- 0.18 . 3 , tornasync- 0.6 . 0 .post2, black- 0.3 . 12 asyncio: mode=legacy collected 172 itemstests/test_control_tabs.py s..... [ 3 %] tests/test_fault_manager.py s............ [ 11 %] tests/test_main_window.py s.. [ 12 %] tests/test_model.py s...................... [ 26 %] tests/test_utility_monitor.py s................... [ 37 %] tests/test_utils.py s..... [ 41 %] tests/controltab/test_tab_actuator_control.py s........... [ 48 %] tests/controltab/test_tab_alarm_warn.py s....... [ 52 %] tests/controltab/test_tab_cell_status.py s.... [ 55 %] tests/controltab/test_tab_config_view.py s. [ 56 %] tests/controltab/test_tab_default.py s.. [ 58 %] tests/controltab/test_tab_detailed_force.py s.. [ 60 %] tests/controltab/test_tab_diagnostics.py s........ [ 65 %] tests/controltab/test_tab_overview.py s...... [ 69 %] tests/controltab/test_tab_rigid_body_pos.py s.... [ 72 %] tests/controltab/test_tab_settings.py s.. [ 74 %] tests/controltab/test_tab_utility_view.py s....... [ 79 %] tests/display/test_figure_constant_realtime.py s... [ 81 %] tests/display/test_figure_constant_static.py s......... [ 87 %] tests/display/test_gauge.py s.... [ 90 %] tests/display/test_view_mirror.py s.... [ 93 %] tests/layout/test_layout_control.py s... [ 95 %] tests/layout/test_layout_control_mode.py s... [ 97 %] tests/layout/test_layout_local_mode.py s... [ 100 %]================================= warnings summary ================================== ../../../../opt/lsst/software/stack/conda/envs/lsst-scipipe- 4.1 . 0 /lib/python3. 10 /site-packages/pytest_asyncio/plugin.py: 191 /opt/lsst/software/stack/conda/envs/lsst-scipipe- 4.1 . 0 /lib/python3. 10 /site-packages/pytest_asyncio/plugin.py: 191 : DeprecationWarning: The 'asyncio_mode' default value will change to 'strict' in future, please explicitly use 'asyncio_mode=strict' or 'asyncio_mode=auto' in pytest configuration file. config.issue_config_time_warning(LEGACY_MODE, stacklevel= 2 )-- Docs: https: //docs.pytest.org/en/stable/how-to/capture-warnings.html ==================== 148 passed, 24 skipped, 1 warning in 15 .37s ==================== [saluser @cbef074781db ts_m2gui]$
            wvreeven Wouter van Reeven added a comment - ts_cycle_build PR: https://github.com/lsst-ts/ts_cycle_build/pull/145

            PRs reviewed and merged.

            mareuter Michael Reuter added a comment - PRs reviewed and merged.

            People

              wvreeven Wouter van Reeven
              ttsai Te-Wei Tsai
              Michael Reuter
              Michael Reuter, Te-Wei Tsai, Wouter van Reeven
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Jenkins

                  No builds found.