plugin NAT port: disable the plugin for tests:

The UPnP-IGD devices discovery takes time and is not necessary during tests, so this
plugin is now diable during tests.
This commit is contained in:
Goffi 2025-12-03 17:48:43 +01:00
commit b0a94124d2

View file

@ -17,6 +17,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import sys
from libervia.backend.core.i18n import _
from libervia.backend.core.constants import Const as C
from libervia.backend.core.log import getLogger
@ -28,6 +29,11 @@ from twisted.internet import defer
from twisted.python import failure
import threading
if "pytest" in sys.modules:
# We skip this module during tests to avoid waiting for UPnP-IGD.
raise exceptions.CancelError("This module is not run during tests.")
try:
import miniupnpc
except ImportError:
@ -46,7 +52,7 @@ PLUGIN_INFO = {
}
STARTING_PORT = 6000 # starting point to automatically find a port
DEFAULT_DESC = "SaT port mapping" # we don't use "à" here as some bugged NAT don't manage charset correctly
DEFAULT_DESC = "Libervia port mapping"
class MappingError(Exception):