-
Notifications
You must be signed in to change notification settings - Fork 99
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
Include the prices in the tests #463
Conversation
- The envidonment variable KICOST_CURRENCY_RATES can be used to fake the cunrrency rates. - It must indicate the name of an XML file containing the desired rates. - The format is the one used by the European Central Bank.
- This is a very subtle detail. If we import the logger explicitly we get a copy of the logger variable. So we can't change it "on-the-fly". When using the API from outside we could want to replace the original logger by a logger from the calling script. So here we use the global logger (not a copy) allowing to the calling script to change it.
- Avoid using a dict for QUERY_AVAIABLE_CURRENCIES - Sort the distributors in the query
- The environment variable KICOST_KITSPACE_URL can be used to define it - Main purpose is for debugging, using a fake server.
- The environment variable KICOST_LOG_HTTP can be defined to point to a file. - Queries and responses are appended to the file. - Main purpose is recording the transactions to fake them during debug.
- Now the used currencies are sorted. - This patch also optimizes the way we collect them.
- Now each netlist file has a separated test. So we can run them separately and with different options. - The date collected from the XML is preserved in the converted CSVs. So now we also test the date. - We always fix the currency rates to known values. - Added a mechanism to record the KitSpace queries. Just defining ADD_QUERY_TO_KNOWN to True. - Added a dummy web server to fake the KitSpace transactions. - Enabled the full test for 300-010, acquire-PWM and acquire-PWM_2
Hi @hildogjr ! |
- Python 3.5 inverted them
- Removed unused part_idx - Commented the query_part_stock_code intention - Simpliefied the KiCost to KitSpace distributor name translation
- Defined available_distributors - Avoided a double search on all FIELD_CAT fields - Clarified when we include manf/manf# info
Now the query works for the dummy and real servers. Some (unknown) subtle detail forced me to use a dict in the post call
- Makes query_part_info easier to read - Removes the pseudo-global distributors and currency vars
At this point the patch seems to be usable. |
Question: |
- I verified that Octopart ignores spaces inside the manf#
local_Indium_X2
safelink_receiver
- Now we compute an MD5 instead of a random hash for local parts.
- Also added the missing logs - Now we log stderr and stdout separated
- Detected when asked for prices of the subparts test.
Missing blank lines to separate functions.
- Now all tests support price. - We run a few tests with --no_price because they don't have any part number information.
Hi @hildogjr ! |
KiCost have the capability of "create local virtual distributor" ("hard coding" the price into the an specific filed of the part into the schematic, by using This is an attempt to generate a general distributors template #386:
If I remember correctly this was just a "band aid" fix, removing it was necessary to not create errors on spreadsheet creation. @set-soft thanks by the wonderful improvements on test and code revisions, I am checking your work now. @devbisme / @xesscorp (KiCost's creator) may consider grant so maintenance privileges of the repository to @set-soft. |
This patch allows testing the most important KiCost feature: getting the costs.
To achieve it I'm adding a fake web server that can pretend to be KitSpace's server, but using recorded responses.
In this way we can reproduce the transactions over and over.
The patch also allows to record the transactions and make the currency exchange rates reproducible.