~ubuntu-branches/ubuntu/trusty/pyinotify/trusty-proposed

« back to all changes in this revision

Viewing changes to src/tests/TestProcINotify.py

  • Committer: Bazaar Package Importer
  • Author(s): Hans Ulrich Niedermann
  • Date: 2006-04-02 02:35:31 UTC
  • Revision ID: james.westby@ubuntu.com-20060402023531-3fj27jbd4x9s4752
Tags: upstream-0.5.2
Import upstream version 0.5.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
# -*- coding: iso-8859-1 -*-
 
3
#
 
4
# TestProcINotify.py - inotify's path tests cases
 
5
# Copyright (C) 2006  S�bastien Martini <sebastien.martini@gmail.com>
 
6
#
 
7
# This program is free software; you can redistribute it and/or
 
8
# modify it under the terms of the GNU General Public License
 
9
# as published by the Free Software Foundation.
 
10
#
 
11
# This program is distributed in the hope that it will be useful,
 
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
# GNU General Public License for more details.
 
15
#
 
16
# You should have received a copy of the GNU General Public License
 
17
# along with this program; if not, write to the Free Software
 
18
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 
19
# 02111-1307, USA.
 
20
 
 
21
import unittest
 
22
 
 
23
try:
 
24
    import autopath
 
25
    from src.pyinotify.inotify import max_queued_events, \
 
26
         max_user_instances, max_user_watches
 
27
except ImportError:
 
28
    from inotify import max_queued_events, max_user_instances, \
 
29
         max_user_watches
 
30
 
 
31
 
 
32
class TestProcINotify(unittest.TestCase):
 
33
 
 
34
    def test_write(self):
 
35
        """
 
36
        write proc fs
 
37
        """
 
38
        max_queued_events.value = 16384
 
39
        max_user_instances.value = 128
 
40
        max_user_watches.value = 8192
 
41
 
 
42
 
 
43
    def test_read(self):
 
44
        """
 
45
        read proc fs
 
46
        """
 
47
        self.assertEqual(max_queued_events.value, 16384)
 
48
        self.assertEqual(max_user_instances.value, 128)
 
49
        self.assertEqual(max_user_watches.value, 8192)
 
50
 
 
51
 
 
52
 
 
53
def testsuite():
 
54
    suite = unittest.TestSuite()
 
55
    suite.addTests([TestProcINotify('test_write'),
 
56
                    TestProcINotify('test_read')])
 
57
    return suite
 
58
 
 
59
 
 
60
def test_it():
 
61
    runner = unittest.TextTestRunner(verbosity=2)
 
62
    runner.run(testsuite())
 
63
 
 
64
 
 
65
if __name__ == '__main__':
 
66
    test_it()