frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open-source Zig book

https://www.zigbook.net
350•rudedogg•6h ago•127 comments

Britney Spears' Guide to Semiconductor Physics

https://britneyspears.ac/lasers.htm
106•lachlan_gray•2h ago•37 comments

Browser fingerprinting via favicon

https://github.com/jonasstrehle/supercookie
206•vxvrs•6h ago•48 comments

Heretic: Automatic censorship removal for language models

https://github.com/p-e-w/heretic
406•melded•11h ago•158 comments

PicoIDE – An open IDE/ATAPI drive emulator

https://picoide.com/
31•st_goliath•2h ago•2 comments

How Your Brain Creates 'Aha' Moments and Why They Stick

https://www.quantamagazine.org/how-your-brain-creates-aha-moments-and-why-they-stick-20251105/
39•wjb3•4h ago•4 comments

Dark Pattern Games

https://www.darkpattern.games
113•robotnikman•6h ago•54 comments

A File Format Uncracked for 20 Years

https://landaire.net/a-file-format-uncracked-for-20-years/
36•todsacerdoti•1w ago•2 comments

The Pragmatic Programmer: 20th Anniversary Edition (2023)

https://www.ahalbert.com/technology/2023/12/19/the_pragmatic_programmer.html
72•ahalbert2•5h ago•11 comments

A new chapter begins for EV batteries with the expiry of key LFP patents

https://www.shoosmiths.com/insights/articles/a-new-chapter-begins-for-ev-batteries-with-the-expir...
13•toomuchtodo•2h ago•3 comments

What if you don't need MCP at all?

https://mariozechner.at/posts/2025-11-02-what-if-you-dont-need-mcp/
134•jdkee•7h ago•78 comments

Z3 API in Python: From Sudoku to N-Queens in Under 20 Lines

https://ericpony.github.io/z3py-tutorial/guide-examples.htm
83•amit-bansil•7h ago•3 comments

I finally understand Cloudflare Zero Trust tunnels

https://david.coffee/cloudflare-zero-trust-tunnels
118•eustoria•8h ago•42 comments

Goldman Sachs asks in biotech Report: Is curing patients a sustainable business?

https://www.cnbc.com/2018/04/11/goldman-asks-is-curing-patients-a-sustainable-business-model.html
129•randycupertino•3h ago•71 comments

FPGA Based IBM-PC-XT

https://bit-hack.net/2025/11/10/fpga-based-ibm-pc-xt/
140•andsoitis•10h ago•28 comments

I have recordings proving Coinbase knew about breach months before disclosure

https://jonathanclark.com/posts/coinbase-breach-timeline.html
329•jclarkcom•5h ago•113 comments

The fate of "small" open source

https://nolanlawson.com/2025/11/16/the-fate-of-small-open-source/
139•todsacerdoti•6h ago•99 comments

Why your mock breaks later

https://nedbatchelder.com/blog/202511/why_your_mock_breaks_later.html
17•ingve•3h ago•8 comments

Fourier Transforms

https://www.continuummechanics.org/fourierxforms.html
99•o4c•1w ago•14 comments

Brimstone: ES2025 JavaScript engine written in Rust

https://github.com/Hans-Halverson/brimstone
191•ivankra•14h ago•94 comments

Linux mode setting, from the comfort of OCaml

https://roscidus.com/blog/blog/2025/11/16/libdrm-ocaml/
41•ibobev•6h ago•4 comments

Lithium vs. Lettuce

https://ambrook.com/offrange/photo-essay/lithium-v-lettuce
30•mfburnett•1d ago•4 comments

Decoding Leibniz Notation (2024)

https://www.spakhm.com/leibniz
33•coffeemug•7h ago•5 comments

Anthropic’s paper smells like bullshit

https://djnn.sh/posts/anthropic-s-paper-smells-like-bullshit/
847•vxvxvx•14h ago•264 comments

Garbage collection is useful

https://dubroy.com/blog/garbage-collection-is-useful/
117•surprisetalk•12h ago•39 comments

Open Catalyst Project

https://opencatalystproject.org/
3•mfiguiere•2w ago•0 comments

Shell Grotto, Margate

https://en.wikipedia.org/wiki/Shell_Grotto,_Margate
35•Michelangelo11•1w ago•4 comments

Show HN: Spam classifier in Go using Naive Bayes

https://github.com/igomez10/nspammer
15•igomeza•1w ago•3 comments

The Man Who Keeps Predicting the Web's Death

https://tedium.co/2025/10/25/web-dead-predictions-george-colony/
48•thm•8h ago•35 comments

Waiting for SQL:202y: Group by All

http://peter.eisentraut.org/blog/2025/11/11/waiting-for-sql-202y-group-by-all
43•ingve•5d ago•21 comments
Open in hackernews

Why your mock breaks later

https://nedbatchelder.com/blog/202511/why_your_mock_breaks_later.html
17•ingve•3h ago

Comments

gsnedders•1h ago
Arguably this is a problem in when the patch is unapplied.

Presumably in the coverage case it’s being called by a trace function, which inevitably runs during test execution — and while we want the trace function to be called during the test function, we really want it without any patches the test function is using. But this arguably requires both an ability for the trace function to opt-out of patches and for the patcher to provide a way to temporarily disable all of them.

esafak•1h ago
It is worth pointing out that you can often use containerized services as an alternative to mocking.
Izkata•1h ago
> In Why your mock doesn’t work I explained this rule of mocking:

> Mock where the object is used, not where it’s defined.

For anyone looking for generic advice, this is a quirk of python due to how imports work in that language (details in the linked post) and shouldn't be considered universal.

kaashif•1h ago
Why even mock anything in this example? You need to read the source code to work out what to mock, reaching deep inside the code to name some method to mock.

But what if you just passed in the contents of the file or something?

Edit: oh wait actually this is what the very last line in the blog post says! But I think it should be emphasized more!

lelandbatey•1h ago
I feel like the #1 reason mocks break looks nothing like this and instead looks like: you change the internal behaviors of a function/method and now the mocks interact differently with the underlying code, forcing you to change the mocks. Which highlights how awful mocking as a concept is; it is of truly limited usefulness for anything but the most brittle of tests.

Don't test the wrong things; if you care about some precondition, that should be an input. If you need to measure a side effect, that should be an output. Don't tweak global state to do your testing.

bluGill•38m ago
Most of the real world is about manipulating the real world. For algorithms it is fine to say depend on the pure inputs/outputs. However what we care about is that global state is manipulated correctly and so the integration tests that verify that are what are important. In most cases your algorithm shouldn't be unit tested separately since it is only used in one place and changes when the users change: there is no point in extra tests. If the algorithm is used in many places comprehensive unit tests are important, but they get in the way when the algorithm is used only once and so the tests just inhibit changes to the algorithm as requirements change (you have to change the user, the integration tests, and the unit tests that are redundant).

As such I disagree. Global state is what you should be testing - but you need to be smart about it. How you setup and verify global state matters. Don't confuse global state above with global state of variables, I mean the external state of the program before and after, which means network, file, time, and other IO things.

dherls•1h ago
This blog post talks as if mocking the `open` function is a good thing that people should be told how to do. If you are mocking anything in the standard library your code is probably structured poorly.

In the example the author walks through, a cleaner way would be to have the second function take the Options as a parameter and decouple those two functions. You can then test both in isolation.

bluGill•46m ago
Details matters, but good test doubles here are important. You want to capture all calls to IO and do something different. You don't want tests to break because someone has a different filesystem, didn't set their home directory as you want it setup, or worse is trying to run two different tests at the same time and the other test is changing files the other wants.

Note that I said test doubles. Mocks are a bit over specific - they are about verifying functions are called at the right time with the right arguments, but the easy ability to set return values makes it easy to abuse them for other things (this abuse is good, but it is still abuse of the intent).

In this case you want a fake: a smart service that when you are in a test setups a temporary directory tree that contains all the files you need in the state that particular test needs, and destroys that when the test is done (with an optional mode to keep it - useful if a test fails to see debug). Depending on your situation you may need something for network services, time, or other such things. Note that in most cases a filesystem itself is more than fast enough to use in tests, but you need isolation from other tests. There are a number of ways to create this fake, it could override open, or it could just be a GetMyProgramDir function that you override are two that I can think of.