File: fdf.rst

package info (click to toggle)
python-django-dynamic-fixture 4.0.1-1~bpo12%2B1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-backports
  • size: 616 kB
  • sloc: python: 3,909; makefile: 237; sh: 6
file content (43 lines) | stat: -rw-r--r-- 1,133 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
.. _fdf:

FileSystemDjangoTestCase (New in 1.3.0)
*******************************************************************************

.. contents::
   :local:

*FileSystemDjangoTestCase* has a tear down method to delete all test files generated by tests, to avoid letting trash in the file system::

    class MyTests(FileSystemDjangoTestCase):
        def test_x(self):
            print(dir(self))

It also has a collection of methods to simplify tests that use files, like:

* create_temp_directory
* remove_temp_directory
* create_temp_file
* create_temp_file_with_name
* rename_temp_file
* remove_temp_file
* copy_file_to_dir
* add_text_to_file
* get_directory_of_the_file
* get_filename
* get_filepath
* get_content_of_file
* create_django_file_with_temp_file
* create_django_file_using_file

It also contains a set of assertion methods:

* assertFileExists
* assertFileDoesNotExists
* assertDirectoryExists
* assertDirectoryDoesNotExists
* assertDirectoryContainsFile
* assertDirectoryDoesNotContainsFile
* assertFilesHaveEqualLastModificationTimestamps
* assertFilesHaveNotEqualLastModificationTimestamps
* assertNumberOfFiles