File indexing completed on 2026-04-10 08:39:16
0001
0002
0003
0004
0005
0006
0007
0008
0009 import unittest
0010 import os
0011
0012
0013
0014 from pilot.info.filespec import FileSpec
0015 from pilot.util.tracereport import TraceReport
0016
0017
0018 def check_env():
0019 """
0020 Function to check whether rucio copytool is loaded correctly.
0021 To be used to decide whether to skip some test functions.
0022 :returns True: if rucio copytool is available. Otherwise False.
0023 """
0024 aval = False
0025 return aval
0026
0027
0028 @unittest.skipIf(not check_env(), "No Rucio copytool")
0029 class TestCopytoolRucio(unittest.TestCase):
0030 """
0031 Unit tests for rucio copytool.
0032 """
0033
0034 def setUp(self):
0035 test_file = open('test.txt', 'w')
0036 test_file.write('For test purposes only.')
0037 test_file.close()
0038 fspec_out = FileSpec()
0039 fspec_out.lfn = 'test.txt'
0040 fspec_out.scope = 'user.tjavurek'
0041 fspec_out.checksum = {'adler32': '682c08b9'}
0042 fspec_out.pfn = os.getcwd() + '/' + 'test.txt'
0043 fspec_out.ddmendpoint = 'UNI-FREIBURG_SCRATCHDISK'
0044 self.outdata = [fspec_out]
0045
0046 def test_copy_out_rucio(self):
0047 from pilot.copytool.rucio import copy_out
0048 trace_report = TraceReport()
0049 trace_report.update(eventType='unit test')
0050 copy_out(self.outdata, trace_report=trace_report)
0051 os.remove(self.outdata[0].pfn)
0052
0053
0054 if __name__ == '__main__':
0055 unittest.main()