networktocode/ntc-templates

Another mechanism for command extraction during tests

max-dw-i opened this issue · 4 comments

At the moment commands are extracted from directory names during tests. It works nice when the command does not have any 'special' characters in it. But some commands do have 'special' characters. For example, command :put [:resolve ...] on mikrotik_routeros. On LInux it's ok but Windows won't even allow to make a directory/file with such characters in the name.

Even if we are going to use only Linux, it's still broken here cause glob treats square brackets specially.

Maybe it makes sense to add a new file with the *.cmd extension (similar to current *.raw, *.yml) with the test command in it. Or another way to use tests for commands with 'special' characters.

Does it work within Docker on Windows?

I don't have Windows at hand but since the base image in the dockerfile is python-slim (which uses Debian under the hood), I'm pretty sure it's going to work. If docker-based development is the only officially supported option, it's not a problem, I guess.

But still such commands (with square brackets, semicolons and other special characters) makes directory/file names less readable (in my opinion, of course).

So I'm curious whether it's a good idea to make a more general way of getting commands during tests (not from directory paths)?

And if the decision is that extracting commands from directories' names is fine then this thing

Even if we are going to use only Linux, it's still broken here cause glob treats square brackets specially.

still should be fixed (I could prepare PR).