Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit tests #2

Merged
merged 1 commit into from Sep 15, 2022
Merged

Unit tests #2

merged 1 commit into from Sep 15, 2022

Conversation

azmeuk
Copy link
Contributor

@azmeuk azmeuk commented Sep 14, 2022

This patch:

  • Adds a DNSServer class in dnserver.py. It has a simple interface like server.start(), server.stop() and server.is_running. I hope this can be used as a dns server fixture in other projects.
  • Adds a tox configuration for currently active python versions.
  • Adds a simple unit test, that just makes a request to the DNS.
  • Adds a GHA configuration, for safety.
  • Requires dnslib 0.9.20
  • It refactors the code so it uses zone strings instead of zone path, so it is easier to use in a python context.

@samuelcolvin

@samuelcolvin
Copy link
Owner

Hi really happy to get this to a point where it can be released to pypi, including unit tests.

I would prefer not to use tox, but rather rely on github actions to test on multiple versions - this is mostly because it's the workflow I know best and can therefore support most easily.

Could you refactor this to follow the example of dirty_equals? If there are bits you find confusing, feel free to leave a comment on this PR and omit them.

@azmeuk
Copy link
Contributor Author

azmeuk commented Sep 14, 2022

I removed tox and adapted the GHA yaml config file following what I could read in dirty_equal. I am curious how do you test several python versions on your development machine without tox?

At first I intended to plug pre-commit and some style tools like black, but I thought this would be better in another PR.

@samuelcolvin
Copy link
Owner

I removed tox and adapted the GHA yaml config file following what I could read in dirty_equal. I am curious how do you test several python versions on your development machine without tox?

I have multiple virtualenvs, and if I really need to test between versions quickly, I activate each in a different terminal; but mostly it's not necessary.

At first I intended to plug pre-commit and some style tools like black, but I thought this would be better in another PR.

Sounds good.

- Added a DNSServer class in dnserver.py
- Added a simple unit test
- Added a GHA configuration
@@ -0,0 +1,62 @@
---
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure what this is doing, but I think it shouldn't be there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll merge and check what github thinks, it definitely doesn't have to be there.

@samuelcolvin samuelcolvin merged commit c3ce361 into samuelcolvin:master Sep 15, 2022
@samuelcolvin
Copy link
Owner

thanks so much, I'll make further changes in a new PR.

@samuelcolvin samuelcolvin mentioned this pull request Sep 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants