Skip to content
Snippets Groups Projects
Select Git revision
  • 1e24f45d8791b2605b2dcd623b499e3573699360
  • master default protected
  • L2SS-2199-apply-dab-to-xy
  • L2SS-2417-more-vector-memory
  • test-pytango-10.0.3
  • revert-cs032-ccd-ip
  • deploy-components-parallel
  • fix-chrony-exporter
  • L2SS-2407-swap-iers-caltable-monitoring-port
  • L2SS-2357-fix-ruff
  • sync-up-with-meta-pypcc
  • stabilise-landing-page
  • all-stations-lofar2
  • v0.39.7-backports
  • Move-sdptr-to-v1.5.0
  • fix-build-ubuntu
  • tokens-in-env-files
  • fix-build
  • L2SS-2214-deploy-cdb
  • fix-missing-init
  • add-power-hardware-apply
  • v0.55.5-r2 protected
  • v0.52.8-rc1 protected
  • v0.55.5 protected
  • v0.55.4 protected
  • 0.55.2.dev0
  • 0.55.1.dev0
  • 0.55.0.dev0
  • v0.54.0 protected
  • 0.53.2.dev0
  • 0.53.1.dev0
  • v0.52.3-r2 protected
  • remove-snmp-client
  • v0.52.3 protected
  • v0.52.3dev0 protected
  • 0.53.1dev0
  • v0.52.2-rc3 protected
  • v0.52.2-rc2 protected
  • v0.52.2-rc1 protected
  • v0.52.1.1 protected
  • v0.52.1 protected
41 results

PCC.py

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    test_statistics_device.py 1.43 KiB
    # Copyright (C) 2022 ASTRON (Netherlands Institute for Radio Astronomy)
    # SPDX-License-Identifier: Apache-2.0
    
    from unittest import mock
    
    from tango import server
    from tango.test_context import DeviceTestContext
    
    from test import base
    
    
    class TestStatisticsDevice(base.TestCase):
        def setUp(self):
            super(TestStatisticsDevice, self).setUp()
    
        def test_python_bug(self):
            """Python is bugged and super() calls in ctypes fail
    
            This is the same type of issues that prevents combining metaclasses
            DeviceMeta and ABCMeta
    
            https://github.com/waveform80/picamera/issues/355
            https://bugs.python.org/issue29270
            """
            import ctypes as ct
    
            try:
    
                class TestSubclass(ct.c_uint32):
                    def __repr__(self):
                        return super().__repr__()
    
            except Exception as e:
                self.assertIsInstance(e, TypeError)
    
        @mock.patch.object(server, "get_worker")
        def test_instance_statistics(self, m_worker):
            """Test that we can import and create a statistics device
    
            The import of Statistics fails when both ABCMeta and DeviceMeta are
            combined. Leave this test to prevent regressions when reattempting our
            combined metaclass.
            """
    
            from tangostationcontrol.devices.sdp.statistics import Statistics
    
            with DeviceTestContext(Statistics, process=True) as proxy:
                self.assertTrue(proxy.ping() > 0)