In an experiment, I sabotaged the development server and ran the tests. To my dismay, no test failed. This feature request requests coming up with a test for the development server.
In detail, here is what I did:
I turned the crucial line webapp.router.register_resource(resource) in the file plugins/command/auto/__init.py__ into a comment.
I ran pytest tests/ as recommended by the contributing guidelines.
Expectation: Some tests fail.
Actually seen: The test was happy.
I double-checked that removing that line in an actual Nikola deployment causes the development server to fail miserably; it does not serve the document root (404 HTTP Code).
Related Area: (eg. tasks, compilers, configuration, templates…)
This feature request is not suggesting to change any production code or functionality, but only add material to tests.
Do you want to contribute this yourself as a pull request? (don’t worry about it if you don’t want to/can’t — someone else can take care of it)
[ ] Yes, I have already written code for it (link if available and feasible)
[X] Yes, I don’t have code ready yet (that’s okay!)
[ ] No (that’s okay too!)
I have done stuff like that before. My suggestion / plan is:
Add some directories with a file each that the server can serve (statically to the git repo).
At runtime, open a server port at 127.0.0.1, fetch the port's number, and close it immediately. This yields a port number that is presently unused.
Configure the server to use that port and start it.
Fire a few HTTP requests from the test code against that port and see the answers are as expected.
Does this feature affect backwards compatibility? If yes, in what way?
No.
Rationale and full description: (why should it be added to Nikola?)
This is somewhat related to #3715. Maybe I'll provide a pull request for that one, too (still have not promised). I have a profound dislike regarding providing a pull request without a test.
Requested Feature: (short description)
In an experiment, I sabotaged the development server and ran the tests. To my dismay, no test failed. This feature request requests coming up with a test for the development server.
In detail, here is what I did:
webapp.router.register_resource(resource)
in the fileplugins/command/auto/__init.py__
into a comment.pytest tests/
as recommended by the contributing guidelines.Expectation: Some tests fail.
Actually seen: The test was happy.
I double-checked that removing that line in an actual Nikola deployment causes the development server to fail miserably; it does not serve the document root (404 HTTP Code).
Related Area: (eg. tasks, compilers, configuration, templates…)
This feature request is not suggesting to change any production code or functionality, but only add material to
tests
.Do you want to contribute this yourself as a pull request? (don’t worry about it if you don’t want to/can’t — someone else can take care of it)
I have done stuff like that before. My suggestion / plan is:
Does this feature affect backwards compatibility? If yes, in what way?
No.
Rationale and full description: (why should it be added to Nikola?)
This is somewhat related to #3715. Maybe I'll provide a pull request for that one, too (still have not promised). I have a profound dislike regarding providing a pull request without a test.