Imputation with mean of column (feature)
I'd argue that there is a third option:
test_missing_value = mean of traindf
The rationale behind this is that the value to impute is part of the model and thus estimated during model training.
Your two possibilities do have the (potential) disadvantage that prediction (as in testing) needs to work also for a single case. For a single case to be predicted, your first approach doesn't work at all, and the 2nd corresponds to using the training mean.
For a few cases to be predicted, your approaches can be computed. But the imputed value will depend on the choice of cases to be predicted. There is nothing to prevent a user from submitting a batch of the same extreme/edge cases for prediction, leading to a totally different imputed value from what would be reasonable for the overall population of your application.
In contrast, during training you have good control on what cases enter the calculation of the imputed values: you can and should make sure the value to be imputed is calculated from a sufficiently large and representatively chosen data set.
Imputation with mean of row (case)
There are some types of data where it is sensible to impute within each case (e.g. mean of neighboring available wavelengths for spectroscopy). In that case, each case is treated separately and you can do that for each of your test cases.