Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions irods/helpers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import contextlib
import os
import sys
from irods import env_filename_from_keyword_args

import irods.exception as ex
from irods.message import ET, XML_Parser_Type, IRODS_VERSION
from irods import env_filename_from_keyword_args
from irods.message import _IRODS_VERSION, ET, XML_Parser_Type
from irods.path import iRODSPath
from irods.session import iRODSSession

Expand Down Expand Up @@ -54,9 +55,12 @@ def make_session(test_server_version=False, **kwargs):

env_file = env_filename_from_keyword_args(kwargs)
session = iRODSSession(irods_env_file=env_file, **kwargs)
# irods.test.helpers version of this function sets test_server_version True by default, so
# that sessions generated for the test methods will abort on connecting with a server that
# is too recent. This is a way to ensure that tests don't fail due to a server mismatch.
if test_server_version:
connected_version = _get_server_version_for_test(session, curtail_length=3)
advertised_version = IRODS_VERSION[:3]
advertised_version = _IRODS_VERSION[:3]
if connected_version > advertised_version:
msg = (
"Connected server is {connected_version}, "
Expand Down
45 changes: 31 additions & 14 deletions irods/message/__init__.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
"""Define objects related to communication with iRODS server API endpoints."""

import struct
import ast
import json
import logging
import os
import socket
import json
import irods.exception as ex
from typing import Optional
import struct
import threading
import xml.etree.ElementTree as ET_xml
from collections import namedtuple
from typing import Optional
from warnings import warn

import defusedxml.ElementTree as ET_secure_xml

import irods.exception as ex

from . import quasixml as ET_quasi_xml
from ..api_number import api_number
from collections import namedtuple
import os
import ast
import threading
from .message import Message
from .property_types import (
ArrayProperty,
BinaryProperty,
StringProperty,
IntegerProperty,
LongProperty,
ArrayProperty,
StringProperty,
SubmessageProperty,
)
from ..api_number import api_number


class Bad_AVU_Field(ValueError):
Expand Down Expand Up @@ -181,7 +185,20 @@ def ET(xml_type=(), server_version=None):

logger = logging.getLogger(__name__)

IRODS_VERSION = (5, 0, 2, "d")
# The symbol _IRODS_VERSION is for internal use in testing only. It indicates the current
# server version for which PRC has maintained compatibility. Attempting the unit tests with
# more recent servers will fail by design.
_IRODS_VERSION = (5, 0, 2, "d")

# This is the older, now deprecated, version of the above symbol.
_deprecated_names = {"IRODS_VERSION": _IRODS_VERSION}


def __getattr__(name):
if name in _deprecated_names:
warn(f"{name} is deprecated", DeprecationWarning, stacklevel=2)
return _deprecated_names[name]
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")

UNICODE = str

Expand Down Expand Up @@ -473,8 +490,8 @@ def __init__(self, proxy_user, client_user, application_name=""):
self.connectCnt = 0
self.proxyUser, self.proxyRcatZone = proxy_user
self.clientUser, self.clientRcatZone = client_user
self.relVersion = "rods{}.{}.{}".format(*IRODS_VERSION)
self.apiVersion = "{3}".format(*IRODS_VERSION)
self.relVersion = "rods{}.{}.{}".format(*_IRODS_VERSION)
self.apiVersion = "{3}".format(*_IRODS_VERSION)
self.option = application_name

irodsProt = IntegerProperty()
Expand Down
13 changes: 7 additions & 6 deletions irods/test/helpers.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
import base64
import contextlib
import io
import datetime
import hashlib
import inspect
import io
import json
import logging
import math
import os
import shutil
import socket
import random
import re
import shutil
import socket
import sys
import tempfile
import threading

import irods.client_configuration as config
import irods.rule
from irods.helpers import (
home_collection,
make_session as _irods_helpers_make_session)
from irods.message import iRODSMessage, IRODS_VERSION
make_session as _irods_helpers_make_session,
)
from irods.message import iRODSMessage
from irods.password_obfuscation import encode
import irods.rule
from irods.session import iRODSSession


Expand Down