You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b121fae
Browse filesBrowse the repository at this point in the historyBrowse files
* Update .gitignore with additional generated files
* Simplify MANIFEST.in with only necessary includes
* Enhance Makefile.tests with pytest support and better test targets
* Enhance README with markdown formatting and improved test documentation
* Modernize archiver.py with pathlib and improve resource handling
* Clean up compressor.py formatting and remove unnecessary whitespace
* Fix regex patterns in ppd.py using raw byte strings for proper escaping
* Enhance runner.py with improved logging configuration and error handling
* Reorganize pyppd-ppdfile.in template and fix imports
* Update setup.py to use setuptools and add proper package configuration
* Update test suite with more robust test cases and error handling
* Enhance README with detailed testing framework and implementation design documentation
``pyppd`` is a CUPS PPD generator. It holds an compressed archive of PPDs, which
5
-
can be listed and retrieved only when needed by CUPS, saving disk space.
3
+
`pyppd` is a CUPS PPD generator. It holds a compressed archive of PPDs, which can be listed and retrieved only when needed by CUPS, saving disk space.
6
4
7
-
Installation
8
-
------------
5
+
## Installation
9
6
10
-
To install ``pyppd``, you can use:
7
+
To install `pyppd`, you can use:
11
8
12
-
# pip install pyppd
9
+
```
10
+
# pip install pyppd
11
+
```
13
12
14
13
Or download the source package, uncompress, and run as root:
15
14
16
-
# python3 setup.py install
15
+
```
16
+
# python3 setup.py install
17
+
```
17
18
18
-
It depends on Python 2.x or 3.x (http://www.python.org) and XZ Utils
19
-
(http://tukaani.org/xz/).
19
+
It depends on Python 3.x (http://www.python.org) and XZ Utils (http://tukaani.org/xz/).
20
20
21
-
Usage
22
-
-----
21
+
## Usage
23
22
24
-
At first, you have to create a PPD archive. For such, put all PPDs (they might
25
-
be gzipped) you want to add in the archive inside a single folder (which can
26
-
have subfolders), then run:
23
+
At first, you have to create a PPD archive. For such, put all PPDs (they might be gzipped) you want to add in the archive inside a single folder (which can have subfolders), then run:
27
24
28
-
$ pyppd /path/to/your/ppd/folder
25
+
```
26
+
$ pyppd /path/to/your/ppd/folder
27
+
```
29
28
30
-
It'll create ``pyppd-ppdfile`` in your current folder. This executable only
31
-
works with the same Python version that you used to generate it. You can test
32
-
it by running:
29
+
It'll create `pyppd-ppdfile` in your current folder. This executable only works with the same Python version that you used to generate it. You can test it by running:
33
30
34
-
$ ./pyppd-ppdfile list
31
+
```
32
+
$ ./pyppd-ppdfile list
33
+
```
35
34
36
35
And, for reading a PPD from the archive, simply do:
For CUPS to be able to use your newly-created archive, copy ``pyppd-ppdfile``
41
-
to ``/usr/lib/cups/driver/`` and you're done.
41
+
For CUPS to be able to use your newly-created archive, copy `pyppd-ppdfile` to `/usr/lib/cups/driver/` and you're done.
42
42
43
-
The generated ``pyppd-ppdfile`` can be arbitrarily renamed, so that more than
44
-
one packed repository can be installed on one system. This can be useful if
45
-
you need a better performance, be it in time or memory usage. Note that also
46
-
the PPD URIs will follow the new name:
43
+
The generated `pyppd-ppdfile` can be arbitrarily renamed, so that more than one packed repository can be installed on one system. This can be useful if you need better performance, be it in time or memory usage. Note that also the PPD URIs will follow the new name:
47
44
48
-
$ ./pyppd-ppdfile list
49
-
pyppd-ppdfile:LasterStar/LaserStar-XX100.ppd
50
-
$ mv pyppd-ppdfile laserstar
51
-
$ ./laserstar list
52
-
laserstar:LaserStar/LaserStar-XX100.ppd
45
+
```
46
+
$ ./pyppd-ppdfile list
47
+
pyppd-ppdfile:LasterStar/LaserStar-XX100.ppd
48
+
$ mv pyppd-ppdfile laserstar
49
+
$ ./laserstar list
50
+
laserstar:LaserStar/LaserStar-XX100.ppd
51
+
```
53
52
54
-
Contributors
55
-
------------
53
+
## Testing Framework
56
54
57
-
* **Till Kamppeter** - Original idea, mentoring and feedback. User #0.
55
+
### Overview
58
56
59
-
* **Hin-Tak Leung** - Lots of technical suggestions.
57
+
`pyppd` uses a comprehensive testing approach that includes unit tests, integration tests, and end-to-end functionality tests. The test suite verifies:
60
58
61
-
* **Martin Pitt** - Python 3 port.
59
+
1. **Component functionality**: Each module is tested in isolation to ensure it correctly performs its specific tasks
60
+
2. **Integration between components**: Tests verify that modules work correctly together
61
+
3. **End-to-end functionality**: Tests validate the complete workflow from archive creation to PPD extraction
62
+
4. **Command-line interface**: Ensures the CLI works as expected with various arguments
62
63
63
-
* **Flávio Ribeiro** and **Diógenes Fernandes** - Refactorings and general Python's best practices tips.
64
+
### Test Architecture
64
65
65
-
* **Didier Raboud** - Make archives reproducible, by sorting the list of found PPDs and using JSON dumps instead of Pickle dumps.
66
+
The test suite is organized as follows:
66
67
67
-
* **Sambhav Dusad** - Streaming decompression, to not need to hold the whole decompressed archive in memory.
68
+
- `tests/test_archiver.py` - Tests for the PPD archive creation functionality
69
+
- `tests/test_compressor.py` - Tests for the compression and decompression functions
70
+
- `tests/test_ppd.py` - Tests for PPD file parsing functionality
71
+
- `tests/test_cli.py` - Tests for the command-line interface
72
+
- `tests/test_integration.py` - End-to-end tests verifying the complete workflow
73
+
74
+
The tests use temporary directories and sample PPD files to create controlled environments for testing. This approach ensures that tests can run without affecting the system and can be executed in any environment.
75
+
76
+
### Setting Up a Test Environment
77
+
78
+
For the best testing experience, we recommend using a virtual environment:
79
+
80
+
```bash
81
+
# Create a virtual environment
82
+
python -m venv pyppd-env
83
+
84
+
# Activate the virtual environment
85
+
# On Linux/macOS:
86
+
source pyppd-env/bin/activate
87
+
# On Windows:
88
+
pyppd-env\Scripts\activate
89
+
90
+
# Install development dependencies
91
+
pip install pytest
92
+
```
93
+
94
+
### Running Tests
95
+
96
+
There are several ways to run the tests for pyppd. All methods allow you to run the tests without installing pyppd.
97
+
98
+
#### Method 1: Using the Makefile
99
+
100
+
The simplest way to run tests:
101
+
102
+
```bash
103
+
$ make -f Makefile.tests test
104
+
```
105
+
106
+
For verbose output:
107
+
108
+
```bash
109
+
$ make -f Makefile.tests test-verbose
110
+
```
111
+
112
+
To run just the unit tests:
113
+
114
+
```bash
115
+
$ make -f Makefile.tests test-unit
116
+
```
117
+
118
+
To clean test artifacts:
119
+
120
+
```bash
121
+
$ make -f Makefile.tests clean-test
122
+
```
123
+
124
+
#### Method 2: Using pytest directly
125
+
126
+
```bash
127
+
$ PYTHONPATH=. pytest tests/
128
+
```
129
+
130
+
For more detailed output:
131
+
132
+
```bash
133
+
$ PYTHONPATH=. pytest -v tests/
134
+
```
135
+
136
+
To run only specific test files:
137
+
138
+
```bash
139
+
$ PYTHONPATH=. pytest tests/test_archiver.py
140
+
```
68
141
69
-
* **Google's OSPO** - Initial funding at GSoC 2010.
0 commit comments