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

Add comprehensive test cases #203

Open
spwoodcock opened this issue Oct 12, 2023 · 10 comments
Open

Add comprehensive test cases #203

spwoodcock opened this issue Oct 12, 2023 · 10 comments
Labels
enhancement New feature or request good first issue Issues that welcome contributions Priority: Should have

Comments

@spwoodcock
Copy link
Member

spwoodcock commented Oct 12, 2023

Is your feature request related to a problem? Please describe.

  • osm-fieldwork has a lot of the core functionality needed in other tools (FMTM)
  • There are some test cases here, but we need to cover a few more things that are important not to break.

Describe the solution you'd like

  • Add more test cases. In particular starting with basemapper.py first, then additional modules.
  • OdkCentral.py already has some good test cases, but could do with more, as it underpins FMTM.
@spwoodcock spwoodcock added the good first issue Issues that welcome contributions label Mar 3, 2024
@owolabioromidayo
Copy link
Contributor

Hello!
I want to work on this. It would help me understand the codebase some more.

@donaldte
Copy link

donaldte commented Mar 8, 2024

greeting ! I will be contributing here

@valentina-buoro
Copy link

Hello 👋🏼 @spwoodcock , can I work on this issue too ?

@owolabioromidayo
Copy link
Contributor

Hi @spwoodcock ,

I am writing tests for the make_data_extract.py and filter_data.py modules.

However, I am unable to create a database connection through the URI passed into the MakeDataExtract class which is passed into the PostgresClient class from osm-rawdata.

There are two outcomes from my testing:

  1. I use "underpass" as the dbUri which configures the client to use https://api-prod.raw-data.hotosm.org/v1/ . This seems to be down and I can't establish a connection.

  2. I use URIs based on the docker-compose configurations.
    image

In this case, I get an error from the queryRemote method of the PostgresClient class which states that self.url does not exist.
This is because self.url is only declared when the dbUri is "underpass".
It seems the PostgresClient class only allows for either a localhost connection or a remote connection through underpass.

And localhost doesn't work for the docker-compose configuration.

How should I work around this?

@spwoodcock
Copy link
Member Author

Hi @owolabioromidayo , thanks for the feedback.

Don't worry about updating the tests for make data extract, as it may be removed in future in favour of osm-rawdata.

As for filter data, you could update the code as part of a PR to make it configurable for connections other than localhost (so that testing can be carried out using the container based database).

@spwoodcock
Copy link
Member Author

@valentina-buoro sure thing 😄

@robsavoye
Copy link
Collaborator

Currently all the real functionality of make_data_extract.py is now in osm-rawdata, so all this does now is filter data. So this would be a test for the FilterData() class only.

@owolabioromidayo
Copy link
Contributor

Okay, got it.

The parse method of the FilterData class creates self.tags and self.keep attributes which have been commented out of usage in the cleanData method with a FIXME comment.

What should be done concerning that?

@robsavoye
Copy link
Collaborator

Ignore those. :-) Some of that is from past experiments, and may be brought back to life later, but commented out to reduce introducing weird errors. Eventually we'll clean that up, fixed and added or deleted.

@owolabioromidayo
Copy link
Contributor

Okay :-)

I made a PR with 2 basic tests for filter_data.py now. I also fixed a tiny bug in it.
owolabioromidayo#3

Would appreciate any feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Issues that welcome contributions Priority: Should have
Projects
Development

No branches or pull requests

5 participants