From 61fc4639eeb75bf3dac193207371a831f3c26f66 Mon Sep 17 00:00:00 2001 From: dluyer <53582923+dluyer@users.noreply.github.com> Date: Tue, 6 Aug 2019 12:50:29 -0700 Subject: Fix typo in test name. --- tests/deprecated_test_filedescriptor.py | 82 +++++++++++++++++++++++++++++++++ tests/depricated_test_filedescriptor.py | 82 --------------------------------- 2 files changed, 82 insertions(+), 82 deletions(-) create mode 100755 tests/deprecated_test_filedescriptor.py delete mode 100755 tests/depricated_test_filedescriptor.py (limited to 'tests') diff --git a/tests/deprecated_test_filedescriptor.py b/tests/deprecated_test_filedescriptor.py new file mode 100755 index 0000000..6b0ef3e --- /dev/null +++ b/tests/deprecated_test_filedescriptor.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python +''' +PEXPECT LICENSE + + This license is approved by the OSI and FSF as GPL-compatible. + http://opensource.org/licenses/isc-license.txt + + Copyright (c) 2012, Noah Spurrier + PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY + PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE + COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +''' +import pexpect +import unittest +import PexpectTestCase +import os + +class ExpectTestCase(PexpectTestCase.PexpectTestCase): + def setUp(self): + print(self.id()) + PexpectTestCase.PexpectTestCase.setUp(self) + + def test_fd (self): + fd = os.open ('TESTDATA.txt', os.O_RDONLY) + s = pexpect.spawn (fd) + s.expect ('This is the end of test data:') + s.expect (pexpect.EOF) + assert s.before == ' END\n' + + def test_maxread (self): + fd = os.open ('TESTDATA.txt', os.O_RDONLY) + s = pexpect.spawn (fd) + s.maxread = 100 + s.expect('2') + s.expect ('This is the end of test data:') + s.expect (pexpect.EOF) + assert s.before == ' END\n' + + def test_fd_isalive (self): + fd = os.open ('TESTDATA.txt', os.O_RDONLY) + s = pexpect.spawn (fd) + assert s.isalive() + os.close (fd) + assert not s.isalive() + + def test_fd_isatty (self): + fd = os.open ('TESTDATA.txt', os.O_RDONLY) + s = pexpect.spawn (fd) + assert not s.isatty() + os.close(fd) + +### def test_close_does_not_close_fd (self): +### '''Calling close() on a pexpect.spawn object should not +### close the underlying file descriptor. +### ''' +### fd = os.open ('TESTDATA.txt', os.O_RDONLY) +### s = pexpect.spawn (fd) +### try: +### s.close() +### self.fail('Expected an Exception.') +### except pexpect.ExceptionPexpect, e: +### pass + +if __name__ == '__main__': + unittest.main() + +suite = unittest.makeSuite(ExpectTestCase, 'test') + +#fout = open('delete_me_1','wb') +#fout.write(the_old_way) +#fout.close +#fout = open('delete_me_2', 'wb') +#fout.write(the_new_way) +#fout.close diff --git a/tests/depricated_test_filedescriptor.py b/tests/depricated_test_filedescriptor.py deleted file mode 100755 index 6b0ef3e..0000000 --- a/tests/depricated_test_filedescriptor.py +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env python -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' -import pexpect -import unittest -import PexpectTestCase -import os - -class ExpectTestCase(PexpectTestCase.PexpectTestCase): - def setUp(self): - print(self.id()) - PexpectTestCase.PexpectTestCase.setUp(self) - - def test_fd (self): - fd = os.open ('TESTDATA.txt', os.O_RDONLY) - s = pexpect.spawn (fd) - s.expect ('This is the end of test data:') - s.expect (pexpect.EOF) - assert s.before == ' END\n' - - def test_maxread (self): - fd = os.open ('TESTDATA.txt', os.O_RDONLY) - s = pexpect.spawn (fd) - s.maxread = 100 - s.expect('2') - s.expect ('This is the end of test data:') - s.expect (pexpect.EOF) - assert s.before == ' END\n' - - def test_fd_isalive (self): - fd = os.open ('TESTDATA.txt', os.O_RDONLY) - s = pexpect.spawn (fd) - assert s.isalive() - os.close (fd) - assert not s.isalive() - - def test_fd_isatty (self): - fd = os.open ('TESTDATA.txt', os.O_RDONLY) - s = pexpect.spawn (fd) - assert not s.isatty() - os.close(fd) - -### def test_close_does_not_close_fd (self): -### '''Calling close() on a pexpect.spawn object should not -### close the underlying file descriptor. -### ''' -### fd = os.open ('TESTDATA.txt', os.O_RDONLY) -### s = pexpect.spawn (fd) -### try: -### s.close() -### self.fail('Expected an Exception.') -### except pexpect.ExceptionPexpect, e: -### pass - -if __name__ == '__main__': - unittest.main() - -suite = unittest.makeSuite(ExpectTestCase, 'test') - -#fout = open('delete_me_1','wb') -#fout.write(the_old_way) -#fout.close -#fout = open('delete_me_2', 'wb') -#fout.write(the_new_way) -#fout.close -- cgit v1.2.1 From dc1a762ee9f144c267b48c2cba1c72b8f47656fa Mon Sep 17 00:00:00 2001 From: dluyer <53582923+dluyer@users.noreply.github.com> Date: Tue, 6 Aug 2019 12:51:56 -0700 Subject: Mark disabled test as deprecated. --- tests/deprecated_test_run_out_of_pty.py | 51 +++++++++++++++++++++++++++++++++ tests/test_run_out_of_pty.py | 51 --------------------------------- 2 files changed, 51 insertions(+), 51 deletions(-) create mode 100755 tests/deprecated_test_run_out_of_pty.py delete mode 100755 tests/test_run_out_of_pty.py (limited to 'tests') diff --git a/tests/deprecated_test_run_out_of_pty.py b/tests/deprecated_test_run_out_of_pty.py new file mode 100755 index 0000000..3090147 --- /dev/null +++ b/tests/deprecated_test_run_out_of_pty.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +''' +PEXPECT LICENSE + + This license is approved by the OSI and FSF as GPL-compatible. + http://opensource.org/licenses/isc-license.txt + + Copyright (c) 2012, Noah Spurrier + PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY + PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE + COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +''' +import pexpect +import unittest +from . import PexpectTestCase + +class ExpectTestCase(PexpectTestCase.PexpectTestCase): + # This takes too long to run and isn't all that interesting of a test. + def OFF_test_run_out_of_pty (self): + '''This assumes that the tested platform has < 10000 pty devices. + This test currently does not work under Solaris. + Under Solaris it runs out of file descriptors first and + ld.so starts to barf: + ld.so.1: pt_chmod: fatal: /usr/lib/libc.so.1: Too many open files + ''' + plist=[] + for count in range (0,10000): + try: + plist.append (pexpect.spawn('ls -l')) + except pexpect.ExceptionPexpect: + for c in range (0, count): + plist[c].close() + return + except Exception: + err = sys.exc_info()[1] + self.fail ('Expected ExceptionPexpect. ' + str(err)) + self.fail ('Could not run out of pty devices. This may be OK.') + +if __name__ == '__main__': + unittest.main() + +suite = unittest.makeSuite(ExpectTestCase,'test') + diff --git a/tests/test_run_out_of_pty.py b/tests/test_run_out_of_pty.py deleted file mode 100755 index 3090147..0000000 --- a/tests/test_run_out_of_pty.py +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env python -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' -import pexpect -import unittest -from . import PexpectTestCase - -class ExpectTestCase(PexpectTestCase.PexpectTestCase): - # This takes too long to run and isn't all that interesting of a test. - def OFF_test_run_out_of_pty (self): - '''This assumes that the tested platform has < 10000 pty devices. - This test currently does not work under Solaris. - Under Solaris it runs out of file descriptors first and - ld.so starts to barf: - ld.so.1: pt_chmod: fatal: /usr/lib/libc.so.1: Too many open files - ''' - plist=[] - for count in range (0,10000): - try: - plist.append (pexpect.spawn('ls -l')) - except pexpect.ExceptionPexpect: - for c in range (0, count): - plist[c].close() - return - except Exception: - err = sys.exc_info()[1] - self.fail ('Expected ExceptionPexpect. ' + str(err)) - self.fail ('Could not run out of pty devices. This may be OK.') - -if __name__ == '__main__': - unittest.main() - -suite = unittest.makeSuite(ExpectTestCase,'test') - -- cgit v1.2.1